You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
如果子节点包含field_2, 创建兄弟节点需要从3开始
`一种可能得修复方法
getRandomName(propertiesData) {
const currentField = "field_" + fieldNum++;
for (const key in propertiesData) {
if (key === currentField) {
return this.getRandomName(propertiesData);
}
}
return currentField;
},
addFieldAction: function (state, action, oldState) {
const keys = action.prefix;
let oldData = oldState.data;
let name = action.name;
let propertiesData = utils.getData(oldData, keys);
let newPropertiesData = {};
let parentKeys = utils.getParentKeys(keys);
let parentData = utils.getData(oldData, parentKeys);
let requiredData = [].concat(parentData.required || []);
if (!name) {
newPropertiesData = Object.assign({}, propertiesData);
let ranName = "field_" + fieldNum++;
newPropertiesData[ranName] = utils.defaultSchema.string;
requiredData.push(ranName);
} else {
for (let i in propertiesData) {
newPropertiesData[i] = propertiesData[i];
if (i === name) {
let ranName = this.getRandomName(propertiesData); // 不能简单自增需要判断
newPropertiesData[ranName] = utils.defaultSchema.string;
requiredData.push(ranName);
}
}
}
utils.setData(state.data, keys, newPropertiesData);
// add required
parentKeys.push("required");
utils.setData(state.data, parentKeys, requiredData);
}
`
The text was updated successfully, but these errors were encountered:
如果子节点包含field_2, 创建兄弟节点需要从3开始
`一种可能得修复方法
getRandomName(propertiesData) {
const currentField = "field_" + fieldNum++;
for (const key in propertiesData) {
if (key === currentField) {
return this.getRandomName(propertiesData);
}
}
return currentField;
},
addFieldAction: function (state, action, oldState) {
const keys = action.prefix;
let oldData = oldState.data;
let name = action.name;
let propertiesData = utils.getData(oldData, keys);
let newPropertiesData = {};
}
`
The text was updated successfully, but these errors were encountered: