vue-router 4.1.2 无法匹配所有请求路径

按照官方给的404例子写的路由

const routes = [{ path: '/:pathMatch(.*)*', name: 'Index', component: Index }]
const router = createRouter({
    history: createWebHistory(),
    routes,
})

当我访问/a/b/c时是可以正常跳转的,当路径中包含.就无法跳转,比如/a.txt
官方文档:router.vuejs.org/zh/guide/essentia...

github上有一个相似的问题:github.com/vuejs/router/issues/121...

讨论数量: 2

直接在最后路由配置 path:'/*'试试

1年前 评论
Libs (楼主) 1年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!