区分环境进行按需加载,提升本地开发加载速度。
更改侧边栏活跃色,让其和element-ui皮肤统一。 修复issue https://github.com/flipped-aurora/gin-vue-admin/issues/1347
This commit is contained in:
25
web/vitePlugin/fullImport/fullImport.js
Normal file
25
web/vitePlugin/fullImport/fullImport.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import * as path from 'path'
|
||||
export default function fullImportPlugin() {
|
||||
let config
|
||||
return {
|
||||
name: 'fullImportElementPlus',
|
||||
async configResolved(conf) {
|
||||
config = conf
|
||||
},
|
||||
transform(code, id) {
|
||||
const sourcePath = path.join(config.root, 'src/main.js').split(path.sep).join('/')
|
||||
const targetPath = id.split(path.sep).join('/')
|
||||
if (sourcePath === targetPath) {
|
||||
const name = 'ElementPlus'
|
||||
|
||||
// 引入 ElementPlus 和 样式
|
||||
const prepend = `import ${name} from 'element-plus';\nimport 'element-plus/theme-chalk/src/index.scss';\n`
|
||||
|
||||
code = code.replace('.mount(', ($1) => `.use(${name})` + $1)
|
||||
return prepend + code
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user