feat: 动态注册组件,优化首页出现性能

This commit is contained in:
MTrun
2022-02-25 22:10:18 +08:00
parent 4a76e419be
commit 0bf38c032c
5 changed files with 18 additions and 16 deletions
+9
View File
@@ -1,6 +1,15 @@
import { defineAsyncComponent, AsyncComponentLoader } from 'vue'
import { AsyncLoading, AsyncSkeletonLoading } from '@/components/LoadingComponent'
/**
* * 动态注册组件
*/
export const componentInstall = <T> (key:string, node: T) => {
if(!window['$vue'].component(key)) {
window['$vue'].component(key, node)
}
}
/**
* * 异步加载组件
* @param loader