vue-router異步加載組件

export default {
    routes: [

    {
        path: '/fund',
        name: 'FundManagement',
        component: function(resolve) {
            resolve(require('userManage'))
        },
        children: [{
            path: '/fund/fundlist',
            name: 'FundList',
            component: function(resolve) {
                require.ensure(['fundList'], () => {
                    resolve(require('fundList'))
                });
            },
            meta: {
                menuName: '基金列表'
            }
        }, {
            path: '/fund/intelliComb',
            name: 'IntelliComb',
            component: function(resolve) {
                require.ensure(['intelliComb'], () => {
                    resolve(require('intelliComb'))
                });
            },
            meta: {
                menuName: '智能組合產品'
            }
        }, ]
    },
]}

同步:異步

component: function(resolve) {
     resolve(require('userManage'))
}

異步:ui

component: function(resolve) {
       require.ensure(['fundList'], () => {
              resolve(require('fundList'))
       });
},
相關文章
相關標籤/搜索