From 6c121bd5c3bb6c0a538ed8e86a662a1796a8236e Mon Sep 17 00:00:00 2001 From: villain <284549247@qq.com> Date: Thu, 11 Jan 2024 20:00:55 +0800 Subject: [PATCH] update --- vue-qa.md | 31 +++++++++++++++++++++++++++++++ vue.md | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 vue-qa.md diff --git a/vue-qa.md b/vue-qa.md new file mode 100644 index 0000000..4c10b9e --- /dev/null +++ b/vue-qa.md @@ -0,0 +1,31 @@ +# 前端开发中的问题整理 + + +1. 路由引入时,如果是动态引入,要使用方法来引入 + +``` +import MapView from '@/views/MapView.vue' + +const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/', + name: 'home', + component: MainView + }, + { + path: '/mapView', + name: 'mapView', + component: MapView, ✅ + }, + { + path:'/login', + name:'login', + // component: import('@/views/Login.vue') ❌ 有可能出bug引入文件失败 + component: () => import('@/views/Login.vue') ✅ + }, + ] +}) +``` + \ No newline at end of file diff --git a/vue.md b/vue.md index 0dc8755..d5cb3fa 100644 --- a/vue.md +++ b/vue.md @@ -171,6 +171,6 @@ import DevicePage from '@/views/device/DevicePage.vue' * ##### 路由定义每个页面必须带上meta属性,其中meta.title为页面标题,meta.icon为页面图标,meta.keepAlive为页面是否需要缓存,如: - +* ##### [开发中遇到的问题整理](./vue-qa.md) * ##### 待补充