重构自动化代码,修复皮肤bug (#1355)
* 增加读取ast方法和AddImport 方法来增加引用包功能 * 增加在指定方法中添加头部声明global.DB业务库的方法 * 增加了自动添加AutoMigrate方法。 * 将自动化产生自动迁移功能替换为新ast * 增加了自动注册router块的功能 * 废除旧的对router和gorm的处理方法,替换为新的自动化方法 * 修复开发模式下皮肤失效的问题
This commit is contained in:
@@ -92,7 +92,9 @@ export default ({
|
||||
}
|
||||
|
||||
if (NODE_ENV === 'development') {
|
||||
config.plugins.push(fullImportPlugin())
|
||||
config.plugins.push(
|
||||
fullImportPlugin()
|
||||
)
|
||||
} else {
|
||||
config.plugins.push(AutoImport({
|
||||
resolvers: [ElementPlusResolver()]
|
||||
|
@@ -11,10 +11,9 @@ export default function fullImportPlugin() {
|
||||
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`
|
||||
|
||||
const prepend = `import ${name} from 'element-plus';\n`
|
||||
code = code.replace(`import './style/element_visiable.scss'`, ($1) => $1 + `\nimport 'element-plus/theme-chalk/src/index.scss'`)
|
||||
code = code.replace('.mount(', ($1) => `.use(${name})` + $1)
|
||||
return prepend + code
|
||||
}
|
||||
|
Reference in New Issue
Block a user