自己项目中的写法

const router = new Router({
routes: [
{
path: '/index',
component: (resolve) => {
require(['../components/index/index'], resolve) // 这里是你的模块 不用import去引入了
}
}
]
})

第二种:

正常写法

const router = new Router({
routes: [
{
path: '/hyh',
component: hyh,
name: 'hyh'
}
]
})
const hyh = resolve => {
import ('@/components/index/hyh').then(modul =>{
resolve(module)
})
}

第三种

// r就是resolve
const list = r => require.ensure([], () => r(require('../components/list/list')), 'list');
// 路由也是正常的写法 这种是官方推荐的写的 按模块划分懒加载
const router = new Router({
routes: [
{
path: '/list/blog',
component: list,
name: 'blog'
}
]
})

最新文章

  1. Android 数字签名
  2. haxe jni调用输入法
  3. php + jQuery自动完成插件autocompleter
  4. jpa注解
  5. RPM 包下载 GCC 4.8安装
  6. Web三维技术:Flash Builder+away3d平台搭建(含演示视频)
  7. mysql笔记4之数据操作
  8. HDMI中的AVmute是什么功能
  9. React 基础入门
  10. Python编程从入门到实践笔记——函数
  11. (办公)mysql安装完,只能通过localhost访问,而不能通过本机ip访问.(转)
  12. [dev][socket] unix domain socket删除socket文件
  13. Linux学习笔记之Linux添加/删除用户和用户组
  14. python之路-----前端之html协议一
  15. 经典影响力传播模型LT模型、IC模型
  16. [每周一文]week 1
  17. slab着色,可以减少cache conflict miss概率么?
  18. DevExpress使用技巧总结
  19. php-fpm配置及操作
  20. 2018.07.27 bzoj4695: 最假女选手(线段树)

热门文章

  1. common-jdbc:一个基于SpringJdbcTemplate的高性能数据库操作工具类库
  2. 互联网轻量级框架SSM-查缺补漏第一天
  3. foreach的基本语法
  4. 关于easyui 窗口位置的调整
  5. iDempiere 使用指南 MRP/生产插件 LiberoMFG 源码安装
  6. Linux CentOS如何汉化系统
  7. 重复启动某一款应用,并传递intent参数
  8. Selenium2学习(五)-- SeleniumBuilder辅助定位元素
  9. monkey使用
  10. Windows装系统