GitBucket
4.6.0
Toggle navigation
Sign in
Files
Branches
1
Tags
Issues
Pull Requests
Labels
Milestones
Wiki
08335
/
hivui-platform-template
hivui平台项目模板
Browse code
@中文描述:设置hiui调试的配置
@版本: @升级登记:1 @同步后端:0 @同步数据库:0 @同步配置:0 @向下兼容:1
master
1 parent
61a5f49
commit
78823990252edeca73944af8c74112d1dcf41af0
caibinghong
authored
on 29 May 2023
Showing
3 changed files
project/hivuiMain/index.js
project/hivuiStudio/index.js
vite.config.js
Ignore Space
Show notes
View
project/hivuiMain/index.js
// import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import './assets/iconfonts/iconfont.css' import './assets/page.less' // import 'normalize.css' import './permission' // permission control if(process.env.hiui_debug){ //这样多次引用element //hiui调试时用 Vue.use(ELEMENT) } //設置script引入全局的ELEMENT 配置 Vue.prototype.$ELEMENT = { size: 'mini', zIndex: 3000 }; import GeminiScrollbar from 'vue-gemini-scrollbar' Vue.use(GeminiScrollbar) import Message from './components/vue-m-message' Vue.use(Message) // will mount `Vue.prototype.$message` /*任务中心*/ import 'zhc-flowchart/lib/zhc-flowchart.css' import zhcflowchart from "zhc-flowchart"; Vue.use(zhcflowchart) Vue.config.productionTip = false import Package from '../../package.json' console.log( '%c hi-vui-template %c v'.concat(Package.version, ' '), 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #5584ff; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;', ); Vue.directive('add2Body', { // 当被绑定的元素插入到 DOM 中时…… inserted: function (el) { document.body.appendChild(el); } }); let hiSetting = HIVUI_SETTING; Vue.prototype.$HI = { projectName: hiSetting.projectName, request: hiSetting.request, queryOperate: hiSetting.queryOperate, pageSize: 20, saveUrl: hiSetting.saveUrl, queryUrl: hiSetting.queryUrl, datasetUrl: hiSetting.datasetUrl, policyUrl: hiSetting.policyUrl, upload: hiSetting.upload, download: hiSetting.download, review: hiSetting.review, getFlowInfo: hiSetting.getFlowInfo, getApprovalInfo: hiSetting.getApprovalInfo, processFlow: hiSetting.processFlow, queryTask: hiSetting.queryTask, withdrawtask: hiSetting.withdrawtask, taskDiagram: hiSetting.taskDiagram, openOrdernumber: hiSetting.openOrdernumber, editorImgServer :hiSetting.review+"?relativePath=" }; new Vue({ router, store, render: h => h(App) }).$mount('#app')
// import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import './assets/iconfonts/iconfont.css' import './assets/page.less' // import 'normalize.css' import './permission' // permission control //設置script引入全局的ELEMENT 配置 Vue.prototype.$ELEMENT = { size: 'mini', zIndex: 3000 }; import GeminiScrollbar from 'vue-gemini-scrollbar' Vue.use(GeminiScrollbar) import Message from './components/vue-m-message' Vue.use(Message) // will mount `Vue.prototype.$message` /*任务中心*/ import 'zhc-flowchart/lib/zhc-flowchart.css' import zhcflowchart from "zhc-flowchart"; Vue.use(zhcflowchart) Vue.config.productionTip = false import Package from '../../package.json' console.log( '%c hi-vui-template %c v'.concat(Package.version, ' '), 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #5584ff; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;', ); Vue.directive('add2Body', { // 当被绑定的元素插入到 DOM 中时…… inserted: function (el) { document.body.appendChild(el); } }); let hiSetting = HIVUI_SETTING; Vue.prototype.$HI = { projectName: hiSetting.projectName, request: hiSetting.request, queryOperate: hiSetting.queryOperate, pageSize: 20, saveUrl: hiSetting.saveUrl, queryUrl: hiSetting.queryUrl, datasetUrl: hiSetting.datasetUrl, policyUrl: hiSetting.policyUrl, upload: hiSetting.upload, download: hiSetting.download, review: hiSetting.review, getFlowInfo: hiSetting.getFlowInfo, getApprovalInfo: hiSetting.getApprovalInfo, processFlow: hiSetting.processFlow, queryTask: hiSetting.queryTask, withdrawtask: hiSetting.withdrawtask, taskDiagram: hiSetting.taskDiagram, openOrdernumber: hiSetting.openOrdernumber, editorImgServer :hiSetting.review+"?relativePath=" }; new Vue({ router, store, render: h => h(App) }).$mount('#app')
Ignore Space
Show notes
View
project/hivuiStudio/index.js
// import Vue from 'vue'; // import ElementUI from 'element-ui'; import App from "./index.vue"; import 'zhc-flowchart/lib/zhc-flowchart.css' import zhcflowchart from "zhc-flowchart"; import 'zhc-visualstudio/lib/zhc-visualstudio.css' import { VisualStudioStore as store, AttrPanel, elDragDialog } from "zhc-visualstudio"; import VisualStudioLayout from "zhc-visualstudio"; Vue.directive('el-drag-dialog', elDragDialog);//添加标签事件绑定 可以放大移动弹窗 Vue.component("AttrPanel", AttrPanel); Vue.use(zhcflowchart); Vue.use(VisualStudioLayout); if(process.env.hiui_debug){ //这样多次引用element //hiui调试时用 Vue.use(ELEMENT) } Vue.prototype.$ELEMENT = { size: 'mini', zIndex: 3000 }; import contentmenu from "v-contextmenu"; Vue.use(contentmenu) new Vue({ el: '#app', store, render: h => h(App) })
// import Vue from 'vue'; // import ElementUI from 'element-ui'; import App from "./index.vue"; import 'zhc-flowchart/lib/zhc-flowchart.css' import zhcflowchart from "zhc-flowchart"; import 'zhc-visualstudio/lib/zhc-visualstudio.css' import { VisualStudioStore as store, AttrPanel, elDragDialog } from "zhc-visualstudio"; import VisualStudioLayout from "zhc-visualstudio"; Vue.directive('el-drag-dialog', elDragDialog);//添加标签事件绑定 可以放大移动弹窗 Vue.component("AttrPanel", AttrPanel); Vue.use(zhcflowchart); Vue.use(VisualStudioLayout); //这样多次引用element // Vue.use(ELEMENT, { // size: 'mini' // }) Vue.prototype.$ELEMENT = { size: 'mini', zIndex: 3000 }; import contentmenu from "v-contextmenu"; Vue.use(contentmenu) new Vue({ el: '#app', store, render: h => h(App) })
Ignore Space
Show notes
View
vite.config.js
const { resolve } = require('path'); import { defineConfig, loadEnv } from 'vite' import { createVuePlugin } from "vite-plugin-vue2"; import vueJsx from '@vitejs/plugin-vue-jsx' import pageData from "vite-plugin-pagedata" import vitefunc from './vite-plugin/vite-plugin-func' import { injectHtml } from 'vite-plugin-html'; const pkg = require("./package.json"); // let dependencies = []; // for(let key in pkg.dependencies){ // if(['font-awesome'].indexOf(key)==-1) // dependencies.push(key) // } // console.log('------dependencies------',dependencies) const projectName = pkg.name == 'hi-vui-template' ? 'project' : pkg.name; // https://vitejs.dev/config/ export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; let aliases = {} let build = { sourcemap: false, //编译 //指定 多个 .html 文件作为入口点 rollupOptions: { // 请确保外部化那些你的库中不需要的依赖 // external: ['vue'], input: { main: resolve(__dirname, 'index.html'), nested: resolve(__dirname, 'nested/index.html') }, output: { format: 'umd', } } } if (mode == 'development') { aliases = { '@project': resolve(`${projectName}`), '@main': resolve(`${projectName}/hivuiMain`), '@birt': resolve(`${projectName}/hivuiBirt`), 'pinyin': 'js-pinyin', //预览引用指定目录下的element 'element-ui':resolve(__dirname,`./build/vite_preview/element_ui.js`), //开启下面注释,scp5.0本地调式指定 //'@':resolve(__dirname, './hi-ui/src'), } } const postDataName = "scpRequestData"; return defineConfig({ // 被监听的包必须被排除在优化之外, // 预览时,预编译这些包,以防vite 启动后,浏览器通过自动模块加载导致刷新页面 optimizeDeps:{ //预编译加载这些,提升速度 include: [ 'axios', 'babel-polyfill', 'classnames', 'echarts', 'enquire.js', 'js-cookie', 'js-md5', 'js-pinyin', 'lodash','lodash/findIndex','lodash/cloneDeep','lodash/isPlainObject','lodash/defaultsDeep','lodash/bind', 'screenfull', 'sortablejs', 'vue', 'vue-draggable-resizable', 'vue-gemini-scrollbar', 'vue-jstree', //以下第一次预览时启动不了 // 'hi-ui','hi-taskcenter','zhc-flowchart','zhc-birt-cmps ], // 排除 // exclude: [] }, build: build, define: { 'process.env': { /** * 启用时在入口页中,有一段以下代码,因为ELEMENT有全局、import、两次,所以在调试hiui时,在初始化一次才行 if(process.env.hiui_debug){ //这样多次引用element //hiui调试时用 Vue.use(ELEMENT) } * */ hiui_debug:false //配合 webpack 环境,在vite 下定义一个空的 } }, css: { preprocessorOptions: { less: { javascriptEnabled: true, } }, }, resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.dtvevt', '.dtv','.dvue','.es6'], alias: aliases, }, plugins: [ vitefunc({ varName: postDataName, global: { env: 'dev' }, htmlWebpackPlugin: { vite: true, project: projectName, mode: mode } }), injectHtml({ // 向预览时注入变量,这个变量跟打包时 html-webpack-plugin 注入的一致,用户判断是否是编译状态 injectData: { htmlWebpackPlugin: { vite: true, project: projectName, mode: mode } } }), pageData({ varName: postDataName, global: { env: 'dev' }, }), createVuePlugin({ include:/\.(dvue|vue)$/ }), vueJsx({ // options are passed on to @vue/babel-plugin-jsx }), //影响到eap.umd.min.js 里的require ELEMENT 全局 // requireTransform({ // fileRegex:/.ts$|.tsx$|.vue$|.js$|.jsx$/ // }) ], server: { hmr:{ overlay:false,//不遮罩输出错误信息,但输出控制台 } }, }) };
const { resolve } = require('path'); import { defineConfig, loadEnv } from 'vite' import { createVuePlugin } from "vite-plugin-vue2"; import vueJsx from '@vitejs/plugin-vue-jsx' import pageData from "vite-plugin-pagedata" import vitefunc from './vite-plugin/vite-plugin-func' import { injectHtml } from 'vite-plugin-html'; const pkg = require("./package.json"); // let dependencies = []; // for(let key in pkg.dependencies){ // if(['font-awesome'].indexOf(key)==-1) // dependencies.push(key) // } // console.log('------dependencies------',dependencies) const projectName = pkg.name == 'hi-vui-template' ? 'project' : pkg.name; // https://vitejs.dev/config/ export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; let aliases = {} let build = { sourcemap: false, //编译 //指定 多个 .html 文件作为入口点 rollupOptions: { // 请确保外部化那些你的库中不需要的依赖 // external: ['vue'], input: { main: resolve(__dirname, 'index.html'), nested: resolve(__dirname, 'nested/index.html') }, output: { format: 'umd', } } } if (mode == 'development') { aliases = { '@project': resolve(`${projectName}`), '@main': resolve(`${projectName}/hivuiMain`), '@birt': resolve(`${projectName}/hivuiBirt`), 'pinyin': 'js-pinyin', //开启下面注释,scp5.0本地调式指定 //'@':resolve(__dirname, './hi-ui/src'), //引用指定目录下的element 'element-ui':resolve(__dirname,`./build/vite_preview/element_ui.js`), } } const postDataName = "scpRequestData"; return defineConfig({ // 被监听的包必须被排除在优化之外, // 预览时,预编译这些包,以防vite 启动后,浏览器通过自动模块加载导致刷新页面 optimizeDeps:{ //预编译加载这些,提升速度 include: [ 'axios', 'babel-polyfill', 'classnames', 'echarts', 'enquire.js', 'js-cookie', 'js-md5', 'js-pinyin', 'lodash','lodash/findIndex','lodash/cloneDeep','lodash/isPlainObject','lodash/defaultsDeep','lodash/bind', 'screenfull', 'sortablejs', 'vue', 'vue-draggable-resizable', 'vue-gemini-scrollbar', 'vue-jstree', //以下第一次预览时启动不了 // 'hi-ui','hi-taskcenter','zhc-flowchart','zhc-birt-cmps ], // 排除 // exclude: [] }, build: build, define: { 'process.env': { //配合 webpack 环境,在vite 下定义一个空的 } }, css: { preprocessorOptions: { less: { javascriptEnabled: true, } }, }, resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.dtvevt', '.dtv','.dvue','.es6'], alias: aliases, }, plugins: [ vitefunc({ varName: postDataName, global: { env: 'dev' }, htmlWebpackPlugin: { vite: true, project: projectName, mode: mode } }), injectHtml({ // 向预览时注入变量,这个变量跟打包时 html-webpack-plugin 注入的一致,用户判断是否是编译状态 injectData: { htmlWebpackPlugin: { vite: true, project: projectName, mode: mode } } }), pageData({ varName: postDataName, global: { env: 'dev' }, }), createVuePlugin({ include:/\.(dvue|vue)$/ }), vueJsx({ // options are passed on to @vue/babel-plugin-jsx }), //影响到eap.umd.min.js 里的require ELEMENT 全局 // requireTransform({ // fileRegex:/.ts$|.tsx$|.vue$|.js$|.jsx$/ // }) ], server: { hmr:{ overlay:false,//不遮罩输出错误信息,但输出控制台 } }, }) };
Show line notes below