修改动态组件加载时机

This commit is contained in:
吕金泽
2022-03-24 01:59:04 +08:00
parent b6d0c2644d
commit c64302caac
3 changed files with 9 additions and 4 deletions
@@ -1,5 +1,6 @@
import { babelParse } from '@vue/compiler-sfc'
import { compileFile } from '@/compiler/sfc-compiler.js'
import { ElLoading } from 'element-plus'
function appComponent(app, item){
var compiled = {}
@@ -27,10 +28,15 @@ function appComponent(app, item){
}
const install = (app) => {
app.config.globalProperties.$post('/component/list', { size: 999999 }).then((res) => {
const loading = ElLoading.service({
lock: true,
background: 'rgba(255, 255, 255, 0)',
})
app.config.globalProperties.$post('/component/list').then((res) => {
res.data.forEach(it => {
appComponent(app, it)
})
loading.close()
})
}
export default install