2文件: el-button type=primary size=small link click=toListrefundInforefundrefundId返回上一级el-button function toListrefundId string consolelog按下了返回上一页的按钮; routerpush name RefundList params
问题的原因是在跳转时没有传递必要的参数。根据代码中注释的部分可以看出,需要传递一个名为"id"的参数,但是在2文件中的代码中注释掉了这部分,导致参数没有传递成功。
要解决这个问题,可以在2文件中的代码中取消注释并传递正确的参数值,例如:
function toList(refundId?: string) { console.log('按下了返回上一页的按钮');
router.push({ name: "RefundList", params: { id: refundId }, }); }
或者,如果没有可用的refundId参数,可以考虑在params中传递一个默认值,例如:
function toList(refundId?: string) { console.log('按下了返回上一页的按钮');
router.push({ name: "RefundList", params: { id: refundId ? refundId : "defaultId" }, }); }
这样,在跳转到1文件时,就会成功传递参数,并且不会报错
原文地址: https://www.cveoy.top/t/topic/iLSQ 著作权归作者所有。请勿转载和采集!