我们通常会在实际开发中,将项目进行分包处理,以此加快项目的速度

即使用异步组件

//异步组件,分包处理
import {defineAsyncComponent} from "vue";
import Loading from "@/11_异步组件的使用/Loading";
//1.
const AsyncCategory = defineAsyncComponent(() => {
import("./AsyncCategory")
}) //2.
// const AsyncCategory = defineAsyncComponent({
// loader:()=>import("./AsyncCategory"),
// //loader没下载下来的时候,用loadingComponent来占位
// loadingComponent:Loading,
// errorComponent:Error,
// //delay:在显示loadingComponent组件之前等待多长时间
// delay:2000,
// /*
// * err是错误信息
// * retry:是一个函数,调用retry尝试重新加载
// * attempts:调用retry的次数
    fail:一个函数,失败后直接退出

// * */
//
  onError(error, retry, fail, attempts) {
if (error.message.match(/fetch/) && attempts <= 3) {
// 请求发生错误时重试,最多可尝试 3 次
retry()
} else {
// 注意,retry/fail 就像 promise 的 resolve/reject 一样:
// 必须调用其中一个才能继续错误处理。
fail()
}
}
//
//
//
// })

export default {
name: "App",
components: {
Loading,
Home,
AsyncCategory
}
}
 

最新文章

  1. Linux 命令——简约汇总
  2. 监听grid行点击事件
  3. Javascript的逻辑判断和循环的知识点
  4. css兼容问题集合
  5. TextArea限制输入长度
  6. leetcode解决问题的方法||Integer to Roman问题
  7. Protel99se轻松入门:一些高级设置和常用技巧
  8. android 中判断WiFi是否可用的可靠方法 ,android 是否联网
  9. 进军VR虚拟现实-先来全景智慧城市-有梦想的互联网创业者
  10. 有序链表--Java实现
  11. 中文版microbit:TurnipBit显示动态滚动字符教程实例
  12. partition分区
  13. selenium+PhantomJS小案例—爬豆瓣网所有电影代码python
  14. ThinkPHP数据库操作相关
  15. response.sendRedirect(url)与request.getRequestDispatcher(url).forward(request,response)的区别
  16. 深入JVM对象引用
  17. http://www.bugku.com:Bugku——备份是个好习惯(http://120.24.86.145:8002/web16/)
  18. 项目经验总结-first
  19. 盘点Linux内核源码中使用宏定义的若干技巧(1)
  20. centos7上docker安装和使用教程

热门文章

  1. vue 中 使用 element-ui 发送请求前 校验全部表单,报警告: [Element Warn][Form]model is required for validate to work!
  2. DHCP原理与LINUX下的配置
  3. Net6 DI源码分析Part3 CallSiteRuntimeResolver,CallSiteVisitor
  4. python篇第10天【For 循环语句】
  5. PL/SQL批量执行SQL脚本文件
  6. Solution -「LOCAL」过河
  7. java Doc的生成方式
  8. Python中类的定制
  9. [VIP] openstack环境配置VIP
  10. 让你的Linux像黑客帝国的画面一样炫酷