懒加载写法:在router.js中
const router=[
{path:'/', redirect:'/index'},
{path:'/index', component: ()=>import('@/components/index')},
{path:'/tiktok', component:()=>import('@/components/tiktok')}
];
// 路由对象
export default new VueRouter({
mode:'history',
routes: router
});
本文介绍了如何在Vue Router中使用懒加载技术,通过示例展示了如何在配置文件中按需引入组件,提高应用性能。
393

被折叠的 条评论
为什么被折叠?



