perf: 优化默认值设置

This commit is contained in:
xiaojunnuo
2024-08-06 11:32:25 +08:00
parent 24c7be2c9c
commit 1af19f0ac0
@@ -148,15 +148,8 @@ export default {
// 给step的input设置默认值 // 给step的input设置默认值
changeCurrentPlugin(currentStep.value); changeCurrentPlugin(currentStep.value);
//赋初始 //合并默认
_.merge(currentStep.value, { input: {}, strategy: { runStrategy: 0 } }, currentPlugin.value.default, currentStep.value); _.merge(currentStep.value, { input: {}, strategy: { runStrategy: 0 } }, currentPlugin.value.default, currentStep.value);
for (const key in currentPlugin.value.input) {
const input = currentPlugin.value.input[key];
if (input.default != null) {
currentStep.value.input[key] = input.default ?? input.value;
}
}
}; };
const stepDrawerShow = () => { const stepDrawerShow = () => {
@@ -229,7 +222,7 @@ export default {
} }
} }
//设置初始值 //设置初始值
if (input.default != null && currentStep.value.input[key] == null) { if ((input.default != null || input.value != null) && currentStep.value.input[key] == null) {
currentStep.value.input[key] = input.default ?? input.value; currentStep.value.input[key] = input.default ?? input.value;
} }
} }