From 9932755c9e61b8d3e49f1f4881a658e091e90e2b Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Fri, 1 Apr 2022 15:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 11 ++-- src/components/HelloWorld.vue | 104 +++++++++++++++++++++++----------- src/main.js | 6 +- src/router/index.js | 10 ++-- src/views/Demo.vue | 7 ++- src/views/Home.vue | 10 ++-- 6 files changed, 96 insertions(+), 52 deletions(-) diff --git a/src/App.vue b/src/App.vue index 2982cc9..fb30b87 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,15 +2,14 @@ import {useRouter} from 'vue-router' const {push}=useRouter() - - function to(e){ - push({name:'demo'}) - } + + diff --git a/src/main.js b/src/main.js index fbc56f2..6fbdc9b 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,9 @@ import router from './router' import store from '@/store' console.log(import.meta.env,'--------------import------') -createApp(App) - .use(router) +var app=createApp(App) +app.use(router) .use(store) .mount('#app') + +app.config.globalProperties.foo='===foo====' // 全局配置属性 \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 13f1855..9438ab6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,19 +1,21 @@ 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: "/", - name: "Home", - component: Home, + name: "home", + component: {...Home,name:"dhome"}, }, { path: "/demo", name: "demo", - component: import("@/views/demo.vue"), + component: b, }, ]; - +window.r=routes const router = createRouter({ history: createWebHashHistory(), routes, diff --git a/src/views/Demo.vue b/src/views/Demo.vue index ff6f779..f7ddeda 100644 --- a/src/views/Demo.vue +++ b/src/views/Demo.vue @@ -2,8 +2,13 @@ \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index 9caf9d9..a99fae0 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -2,9 +2,10 @@