在项目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)
  })
}

即可实现路由懒加载的效果

Logo

前往低代码交流专区

更多推荐