mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-08 06:55:37 +00:00
fix: fieldId 有值时跳过 initial, 因为在目前 vc 的 fieldId 实现是每次返回不同的值
This commit is contained in:
parent
18cfa96f98
commit
0360572476
@ -27,19 +27,25 @@ export function initNodeReducer(props, node) {
|
|||||||
initials.forEach(item => {
|
initials.forEach(item => {
|
||||||
try {
|
try {
|
||||||
// FIXME! item.name could be 'xxx.xxx'
|
// FIXME! item.name could be 'xxx.xxx'
|
||||||
const value = props[item.name];
|
const value = newProps[item.name];
|
||||||
// JSExpression 并且带有 events 字段属于特殊情况,不再处理
|
// 几种不再进行 initial 计算的情况
|
||||||
if (!(isJSExpression(value) && value.events)) {
|
// 1. name === 'fieldId' 并且已经有值
|
||||||
|
// 2. 结构为 JSExpression 并且带有 events 字段
|
||||||
|
if ((item.name === 'fieldId' && value) || (isJSExpression(value) && value.events)) {
|
||||||
|
if (newProps[item.name] && !node.props.has(item.name)) {
|
||||||
|
node.props.add(value, item.name, false, { skipSetSlot: true });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
newProps[item.name] = item.initial(node as any, newProps[item.name]);
|
newProps[item.name] = item.initial(node as any, newProps[item.name]);
|
||||||
|
if (newProps[item.name] && !node.props.has(item.name)) {
|
||||||
|
node.props.add(value, item.name, false, { skipSetSlot: true });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (hasOwnProperty(props, item.name)) {
|
if (hasOwnProperty(props, item.name)) {
|
||||||
newProps[item.name] = props[item.name];
|
newProps[item.name] = props[item.name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newProps[item.name] && !node.props.has(item.name)) {
|
|
||||||
node.props.add(newProps[item.name], item.name, false, { skipSetSlot: true });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return newProps;
|
return newProps;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user