假如父组件中是这样一个复杂的对象,传递给多个子组件,不同子组件要处理该修改中不同的属性,我目前的处理是直接在子组件中修改如props.params.approveStatus = 2
,当然官方并不推荐这种处理,实际情况如何处理更好一些呢?
const params = ref<any>({
approveStatus: 0,
attachment: [],
bidDeadline: '',
bidFileValid: 0,
bidId: null,
bidMode: '',
bidNo: '',
bidScope: '',
bidScopeAttachment: [],
bidStage: 'initiate',
bidTitle: '',
buyMode: 1,
contact: '',
createBy: '',
createTime: '',
enterpriseId: 0,
flag: 0,
inquiryMethod: '',
inquiryMethodAttachment: [],
instanceId: 0,
labelType: 0,
promoterUserId: 0,
promoterUserName: '',
remark: '',
requestionDeadline: '',
sampleMode: 1,
status: 0,
supplierRecommenderId: null,
supplierRecommenderName: '',
technicalStandard: '',
technicalStandardAttachment: [],
updateBy: '',
updateTime: '',
valid: ''
})
你这种多组件处理同一对象的情况,可以使用
Pinia
来做啊。