异步路由
异步路由前提必须使用异步加载机制。
点击查看编译分包和异步加载
routes.ts
引入异步组件
引入方式: () => import('xxx.vue')
js
const routes = [
{
path: '/async-component',
name: 'async-component',
//示例如下:
component: () => import('./views/async/index.vue')
}
]
配置完成,路由会异步加载此路由。