跳转二级页面不通过路由了,因为会新增一个没有名称的tab,而且点击一次会新增一个tab。现在改为引用组件的方式,下面为由路由改为引用组件的步骤
1 引入二级页面组件
import purchasePlanForm from './purchasePlanForm.vue';
export default defineComponent({
name: 'purchaseAuditList',
components: { createView, purchasePlanForm },
setup(){
...
}
});
2 二级页面之前的路由参数改为props
// purchasePlanForm.vue
export default defineComponent({
name: '采购计划管理录入',
props: { // 这些根据自己需要定义,主要是把之前路由的参数都改为props
bill_form_id: {
type: String,
},
bill_id: {
type: String,
},
bill_type_id: {
type: String,
},
business_type: {
type: String,
},
operateflag: {
type: String,
},
auditStatus: {
type: Number,
},
},
});
3 修改二级页面的之前路由参数获取方式,现在改为props获取
let billFormId = props.bill_form_id as string;
let bill_id = props.bill

本文详细介绍了如何将路由系统转换为组件方式,以动态添加无名tab并处理props传递,适合理解组件化开发的进阶者。涉及组件引入、props调整、路由跳转及二级页面管理的全面步骤。
1808

被折叠的 条评论
为什么被折叠?



