From 06a6486fd5f5db31398a82c378e37d0da505f248 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Sat, 2 Apr 2022 14:49:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 0ce1088..bc69db2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,6 @@ import { createRouter, createWebHashHistory } from "vue-router"; import Home from "@/views/home.vue"; import { defineAsyncComponent, defineComponent } from "vue"; -var b=defineAsyncComponent(async()=>await import("@/views/demo.vue").then(v=>({...v.default,name:'ddd'}))) const routes = [ { path: "/", @@ -12,7 +11,10 @@ const routes = [ { path: "/demo", name: "demo", - component: b, + component: import('@/views/demo.vue').then(e=>{ + e.default.name='demo' //组件命名 + return e + }), }, ]; const router = createRouter({ From c0327fdd2f11ff5d2d1746714438131817820bc1 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Sat, 2 Apr 2022 14:50:40 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20index.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index bc69db2..5d8edf9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,7 +11,7 @@ const routes = [ { path: "/demo", name: "demo", - component: import('@/views/demo.vue').then(e=>{ + component: import('@/views/demo.vue').then(e=>{ // 引入文件路径错误,会导致不能热更新 e.default.name='demo' //组件命名 return e }), From 0daf352ef3b77f3e2beb13096d80652d84273961 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Sat, 2 Apr 2022 15:55:37 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Home.vue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/views/Home.vue b/src/views/Home.vue index 80f7a12..8d86a58 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -14,4 +14,9 @@ \ No newline at end of file From 8a98bfe0b93b48d3eac0103c7acd3a220ab6c0bf Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Sat, 2 Apr 2022 15:57:34 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20index.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 5d8edf9..4be6330 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,7 +11,8 @@ const routes = [ { path: "/demo", name: "demo", - component: import('@/views/demo.vue').then(e=>{ // 引入文件路径错误,会导致不能热更新 + // 必须用工厂化函数方式返回,否则打包后变空白 + component: ()=>import('@/views/demo.vue').then(e=>{ // 引入文件路径错误,会导致不能热更新 e.default.name='demo' //组件命名 return e }),