mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-04-27 21:41:22 +08:00
修改动态组件加载时机
This commit is contained in:
parent
b6d0c2644d
commit
c64302caac
@ -54,8 +54,10 @@ import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import Tabs from './tabs.vue'
|
||||
import Sidebar from './sidebar/sidebar.vue'
|
||||
import { logout } from '@/scripts/auth'
|
||||
import dynamicComponent from '@/scripts/dynamicComponent'
|
||||
import { getCurrentInstance } from 'vue'
|
||||
const { proxy } = getCurrentInstance()
|
||||
dynamicComponent(getCurrentInstance().appContext.app)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -67,7 +69,6 @@ const { proxy } = getCurrentInstance()
|
||||
}
|
||||
.title{
|
||||
font-family: PoetsenOne;
|
||||
width: var(--mb-sidebar-width);
|
||||
line-height: 60px;
|
||||
font-size: 24px;
|
||||
color: white;
|
||||
|
@ -15,7 +15,6 @@ import App from './App.vue'
|
||||
import router from './scripts/router'
|
||||
import components from '@/components/index'
|
||||
import globalProperties from './scripts/globalProperties'
|
||||
import dynamicComponent from './scripts/dynamicComponent'
|
||||
import hasPermission from './scripts/hasPermission'
|
||||
|
||||
import '@/permission'
|
||||
@ -34,7 +33,6 @@ router.beforeEach((to, from) => {
|
||||
return true
|
||||
})
|
||||
app.use(globalProperties)
|
||||
app.use(dynamicComponent)
|
||||
app.use(hasPermission)
|
||||
app.use(components)
|
||||
app.use(ElementPlus, {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user