我有一个这样的路由:
routes: [
{
path: '/survey/:surveyHash',
name: 'survey',
component: Survey,
props: true,
},
在组件中,我试图获得surveyHash
个props .问题是,如果surveyHash
个斜线中有/
个斜线,我就做不到.
vue路由中有解决方案吗?
我有一个这样的路由:
routes: [
{
path: '/survey/:surveyHash',
name: 'survey',
component: Survey,
props: true,
},
在组件中,我试图获得surveyHash
个props .问题是,如果surveyHash
个斜线中有/
个斜线,我就做不到.
vue路由中有解决方案吗?
可以在路由定义中使用custom matching pattern
routes: [
{
path: '/survey/:surveyHash(.*)',
name: 'survey',
component: Survey,
props: true,
},
有了这个,你将得到URL的其余部分,包括surveyHash
中的斜杠