负数的正则匹配
问题
跳转路由后,发现地址栏有误。

检查发现控制台警告:
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+)"
参考链接
本文来自博客园,作者:shayloyuki,转载请注明原文链接:https://www.cnblogs.com/shayloyuki/p/17560609.html
posted on 2023-07-17 16:54 shayloyuki 阅读(147) 评论(0) 收藏 举报
浙公网安备 33010602011771号