Browse Source

master

master
邓宏 3 years ago
parent
commit
5f6d9758dd
  1. 4
      package.json
  2. 2
      src/App.vue
  3. 5
      src/router/index.js

4
package.json

@ -4,10 +4,10 @@
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
"build": "vite build", "build": "vite build"
"preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"element-plus": "^2.1.7",
"vue": "^3.2.25", "vue": "^3.2.25",
"vue-router": "^4.0.0-0", "vue-router": "^4.0.0-0",
"vuex": "^4.0.2" "vuex": "^4.0.2"

2
src/App.vue

@ -6,7 +6,7 @@
<template> <template>
<router-view v-slot="{Component}"> <router-view v-slot="{Component}">
<keep-alive :include="['dhome','ddd']"> <keep-alive :include="['dhome','demo']">
<component :is="Component" :key="$route.path"/> <component :is="Component" :key="$route.path"/>
</keep-alive> </keep-alive>
</router-view> </router-view>

5
src/router/index.js

@ -2,7 +2,6 @@ import { createRouter, createWebHashHistory } from "vue-router";
import Home from "@/views/home.vue"; import Home from "@/views/home.vue";
import { defineAsyncComponent, defineComponent } from "vue"; import { defineAsyncComponent, defineComponent } from "vue";
var b=defineAsyncComponent(async()=>await import("@/views/demo.vue").then(v=>({...v.default,name:'ddd'})))
const routes = [ const routes = [
{ {
path: "/", path: "/",
@ -12,12 +11,12 @@ const routes = [
{ {
path: "/demo", path: "/demo",
name: "demo", name: "demo",
component: b, component: ()=>import('@/views/demo.vue').then(e=>({...e.default,name:"demo"})),
}, },
]; ];
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(), history: createWebHashHistory(),
routes, routes,
}); });
window.r=routes
export default router; export default router;
Loading…
Cancel
Save