🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 一、概述 组件懒加载是在组件需要使用的时候才加载。 ## 二、路由中懒加载 ``` const HelloWorld = ()=>import("@/components/HelloWorld") export default new Router({ routes: [ { path: '/', name: 'HelloWorld', component:HelloWorld } ] }) ``` ## 三、实例中配置懒加载 ``` components: {       historyTab: resolve => {require(['../../component/historyTab/historyTab.vue'], resolve)},//懒加载       //historyTab: () => import('../../component/historyTab/historyTab.vue') }, ``` ## 四、全局注册异步组件 > Vue.component('mideaHeader', () => { > System.import('./component/header/header.vue') > })