vuejs / router

🚦 The official router for Vue.js
https://router.vuejs.org/
MIT License
3.74k stars 1.15k forks source link

vite + vue-router@4.3.2 命名视图无法使用 #2257

Closed chrisworkalx closed 1 month ago

chrisworkalx commented 1 month ago

Reproduction

https://codesandbox.io/p/github/chrisworkalx/vue3-vue-router4/master?import=true&workspaceId=d301d11a-f40c-4f7d-816e-6583403e24a0

Steps to reproduce the bug

image

import { createWebHashHistory, createRouter } from "vue-router";
import A1 from "../components/a1.vue";
import A2 from "../components/a2.vue";
import B1 from "../components/b1.vue";
import B2 from "../components/b2.vue";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/a",
      name: "a",
      component: {
        default: A1,
        one: A1,
        two: A2,
      },
    },
    {
      path: "/b",
      name: "b",
      component: {
        default: B1,
        one: B1,
        two: B2,
      },
    },
  ],
});

export default router;

路由跳转页面无法展示 image

Expected behavior

期望是可以展示多个路由视图

Actual behavior

但页面什么都没有展示

Additional information

No response

posva commented 1 month ago

it's components with an s