vue-router实现路由懒加载
在项目router/index.js文件中将import Recommend from 'components/recommend/recommend'更改为const Recommend = (resolve) => {import('components/recommend/recommend').then((module) => {resolve(module)})}即
·
在项目router/index.js文件中将
import Recommend from 'components/recommend/recommend'
更改为
//方法1:
const Recommend = () => import('components/recommend/recommend')
//方法2:
const Recommend = (resolve) => {
import('components/recommend/recommend').then((module) => {
resolve(module)
})
}
即可实现路由懒加载的效果
更多推荐
已为社区贡献19条内容
所有评论(0)