vue懒加载和同步加载

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_40283784/article/details/87718704
//a页面
import historyTab from '../../component/historyTab/historyTab.vue';
export default {
    components: {
        historyTab
    },
}

//b页面
export default {
    components: {
        historyTab: () => import('../../component/historyTab/historyTab.vue'),//懒加载
    }
}

以上的加载方式都加载在同一组件中,如果不同的界面分别以这两种不同的方式引入组件,将会造成资源重用。因为第一种引入方式相当于在html中插入界面,而第二种方法是生成chunk,按照异步的方法加载。

猜你喜欢

转载自blog.csdn.net/qq_40283784/article/details/87718704