Browse Source

路由组件命名

master
邓宏 3 years ago
parent
commit
06a6486fd5
  1. 6
      src/router/index.js

6
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({

Loading…
Cancel
Save