【发布时间】:2022-01-21 00:35:48
【问题描述】:
使用 Vue 2.6.14,Vue Router 设置为历史模式,包含标签“#”的 URL 会破坏动态路径。
const router = new VueRouter({
base: `${process.env.VUE_APP_PUBLIC_PATH}`,
mode: 'history',
routes: [
{
path: '/document/:documentId(.*)',
name: 'Document',
component: Document,
props: true
},
{
path: '*',
name: 'NotFound',
component: NotFound
}
]
});
以“/document/#1”结尾的 URL 作为“documentId”属性的空字符串返回。
【问题讨论】:
标签: vue.js router history mode hashtag