Mortal红尘 Mortal红尘
首页
  • 学习笔记

    • 前端
    • 后端
  • 《ES6教程》
  • 《Git教程》
  • 《JavaScript教程》
  • 《JavaScript文章》
  • 《TypeScript 从零实现 axios》
  • 《Vue教程》
  • 《Vue文章》
  • 《页面与效果》
  • 技术文档
  • GitHub技巧
  • Nodejs
  • Linux
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Mortal红尘

热爱各种技术的一枚憨憨前端
首页
  • 学习笔记

    • 前端
    • 后端
  • 《ES6教程》
  • 《Git教程》
  • 《JavaScript教程》
  • 《JavaScript文章》
  • 《TypeScript 从零实现 axios》
  • 《Vue教程》
  • 《Vue文章》
  • 《页面与效果》
  • 技术文档
  • GitHub技巧
  • Nodejs
  • Linux
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 《ES6 教程》

  • 《Git》

  • 《JavaScript教程》

  • 《TypeScript 从零实现 axios》

  • 《Vue》

    • 基础

    • 组件

    • 过渡&动画

    • 可复用性&组合

    • 工具

    • 规模化

      • vuex操作相关
      • 路由懒加载
    • Vuex

    • 其他

  • JavaScript文章

  • Vue文章

  • 页面

  • 知识库
  • 《Vue》
  • 规模化
xugaoyi
2020-02-04

路由懒加载

# 路由懒加载

// 路由同步加载
// import Recommend from '@/components/recommend/recommend'
// import Singer from '@/components/singer/singer'
// import Rank from '@/components/rank/rank'
// import Search from '@/components/search/search'
// import SingerDetail from '@/components/singer-detail/singer-detail'
// import Disc from '@/components/disc/disc'
// import TopList from '@/components/top-list/top-list'
// import UserCenter from '@/components/user-center/user-center'

Vue.use(Router)

// 路由懒加载
const Recommend = () => import('@/components/recommend/recommend')
const Singer = () => import('@/components/singer/singer')
const Rank = () => import('@/components/rank/rank')
const Search = () => import('@/components/search/search')
const SingerDetail = () => import('@/components/singer-detail/singer-detail')
const Disc = () => import('@/components/disc/disc')
const TopList = () => import('@/components/top-list/top-list')
const UserCenter = () => import('@/components/user-center/user-center')

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

使用路由懒加载可使app.js文件变小,进入不同路由在分别加载该路由的js。

编辑 (opens new window)
#Vue
上次更新: 2024/12/19, 12:18:44
vuex操作相关
Vuex

← vuex操作相关 Vuex→

最近更新
01
TypeScript-概要
8月22日
02
TypeScript快速上手
8月22日
03
常用Git命令清单
11-18
更多文章>
Theme by Vdoing | Copyright © 2021-2025 Mortal红尘 | 黔ICP备2021006288号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×