fix: 🐛 添加 loop 和 condition 的判断

This commit is contained in:
YJSON 2020-08-18 22:01:38 +08:00
parent a01e4b1963
commit b521ebead1

View File

@ -135,7 +135,7 @@ export default function(metadata: TransformedComponentMetadata): TransformedComp
// if (item.type === 'group' && (item.title === '高级' || item.title?.label === '高级')) { // if (item.type === 'group' && (item.title === '高级' || item.title?.label === '高级')) {
// advanceGroup = item.items || []; // advanceGroup = item.items || [];
// propsGroup.splice(l, 1); // propsGroup.splice(l, 1);
// } // }
if (item.name === '__style__' || item.name === 'containerStyle' || item.name === 'pageStyle') { if (item.name === '__style__' || item.name === 'containerStyle' || item.name === 'pageStyle') {
propsGroup.splice(l, 1); propsGroup.splice(l, 1);
stylesGroup.push(item); stylesGroup.push(item);
@ -262,22 +262,26 @@ export default function(metadata: TransformedComponentMetadata): TransformedComp
}, },
}) })
} }
advanceGroup.push({
name: 'key', if(supports.condition !== false || supports.loop !== false) {
title: { advanceGroup.push({
label: '渲染唯一标识key', name: 'key',
tip: '搭配「条件渲染」或「循环渲染」时使用,和 react 组件中的 key 原理相同,点击查看帮助', title: {
docUrl: 'https://yuque.antfin-inc.com/legao/help3.0/ca5in7', label: '渲染唯一标识key',
}, tip: '搭配「条件渲染」或「循环渲染」时使用,和 react 组件中的 key 原理相同,点击查看帮助',
setter: [{ docUrl: 'https://yuque.antfin-inc.com/legao/help3.0/ca5in7',
componentName: 'StringSetter', },
}, { setter: [{
componentName: 'VariableSetter' componentName: 'StringSetter',
}], }, {
extraProps: { componentName: 'VariableSetter'
display: 'block', }],
}, extraProps: {
},) display: 'block',
},
},)
}
} }
if (advanceGroup.length > 0) { if (advanceGroup.length > 0) {
combined.push({ combined.push({