1
0
mirror of synced 2026-03-24 20:18:35 +08:00

fix(ui,runtime): 迭代器容器迭代数据兼容

re #613
This commit is contained in:
roymondchen
2024-05-31 14:45:21 +08:00
parent 7fb4d96cb0
commit 94db430b85
15 changed files with 175 additions and 153 deletions

View File

@@ -22,7 +22,11 @@ interface IteratorContainerProps extends MContainer {
const IteratorContainer: React.FC<IteratorContainerProps> = ({ config, id }) => {
const { app } = useApp({ config });
const { iteratorData = [] } = config;
let { iteratorData = [] } = config;
if (!Array.isArray(iteratorData)) {
iteratorData = [];
}
if (app?.platform === 'editor' && !iteratorData.length) {
iteratorData.push({});

View File

@@ -26,8 +26,13 @@ export default [
checkStrictly: false,
type: 'data-source-field-select',
onChange: (vm: any, v: string[] = [], { model }: any) => {
const [dsId, ...keys] = v;
model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys];
if (Array.isArray(v)) {
const [dsId, ...keys] = v;
model.dsField = [dsId.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, ''), ...keys];
} else {
model.dsField = [];
}
return v;
},
},