{
prop: "ukey",
label: "证券代码",
mold: "bond",
moldProps: {
valueKey: "marketCode",
labelKey: "marketAbbr",
queryKey: "keyWord",
queryUrl: querySecurity,
queryParam: {
marketId: tractMarketId.value, // 绑定动态 marketId
}
onSelectChange: handleBondChange,
},
clearable: true,
required: true,
itemVisible: [1].includes(currentItem.value.scopeSecu),
},
{
prop: "tractId",
label: "交易账户",
filterable: true,
mold: "select",
moldProps: {
labelKey: ["tractCode", "tractName"],
valueKey: "tractId",
labelSeparator: "\u00A0\u00A0",
options: options.authorityTract,
onSelectChange: (val) => handleTractIdChange(val),
},
clearable: true,
itemVisible: [2].includes(currentItem.value.scopeAcc),
required: true,
},
let tractMarketId = ref("");
function handleTractIdChange(val) {
const result = options.authorityTract.find((item) => item.tractId === val);
if (result) {
tractMarketId.value = result.marketId;
}
}
可以看出当交易账户单选框点击变化的时候tractMarketId 也会随之变化,同时参数queryParam也会变化
这个时候会出现VUE渲染不及时
会清空dialog中的所有的值
解决方法:
queryParam: computed(() => ({
marketId: tractMarketId.value, // 绑定动态 marketId
})),
使用computed动态绑定queryParam 当值变化的时候自动更新queryPaream的传参