\u003cp\u003e问题的原因是在跳转时没有传递必要的参数。根据代码中注释的部分可以看出,需要传递一个名为"id"的参数,但是在2文件中的代码中注释掉了这部分,导致参数没有传递成功。\u003c/p\u003e\n\u003cp\u003e要解决这个问题,可以在2文件中的代码中取消注释并传递正确的参数值,例如:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003efunction toList(refundId?: string) {\n console.log('按下了返回上一页的按钮');\n \n router.push({\n name: "RefundList",\n params: { id: refundId },\n });\n}\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e或者,如果没有可用的refundId参数,可以考虑在params中传递一个默认值,例如:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003efunction toList(refundId?: string) {\n console.log('按下了返回上一页的按钮');\n \n router.push({\n name: "RefundList",\n params: { id: refundId ? refundId : "defaultId" },\n });\n}\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e这样,在跳转到1文件时,就会成功传递参数,并且不会报错。\u003c/p\u003e

Vue Router跳转报错:Uncaught Error: No match for {

原文地址: https://www.cveoy.top/t/topic/qr6l 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录