问题
跳转路由后,发现地址栏有误。
检查发现控制台警告:
vue-router.esm.js:16 [vue-router] missing param for named route "StandardVersion": Expected "standardId" to match "\d+", but received "-1"
排查
找到该路由地址:
path: ":standardName/:standardId(\\d+)",
可知,此处的 standardId
为负数时,不满足正则匹配 \d+
。
解决办法
修改正则
path: ":standardName/:standardId([-+]?\\d+)"