技术咸鱼 技术咸鱼
首页
工具
  • 《Django教程》
  • 《VuePress教程》
应用
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 网站
  • 资源
  • Vue资源网站
  • Flutter资源网站
  • 分类
  • 标签
  • 归档
关于
头像

公众号:技术咸鱼
首页
工具
  • 《Django教程》
  • 《VuePress教程》
应用
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 网站
  • 资源
  • Vue资源网站
  • Flutter资源网站
  • 分类
  • 标签
  • 归档
关于
  • 基础

  • 组件

  • 过渡&动画

  • 可复用性&组合

  • 工具

  • 规模化

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

  • 其他

  • 《Vue》笔记
  • 规模化
技术咸鱼
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。

#Vue
上次更新: 2023/01/04, 16:24:33
vuex操作相关
Vuex

← vuex操作相关 Vuex→

最近更新
01
com.intellij.util.io.PersistentEnumeratorBase$CorruptedException PersistentEnumerator storage corrupted
04-23
02
技术咸鱼
03
Pods-Runner target has frameworks with conflicting names XXXX.
04-18
更多文章>
Copyright © 2019-2023 oopanda | 皖ICP备19017961号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×
document.write('');
×