Commit 3b894fd67a2ae0057ae63cc505ce6756066a73c8
Committed by
小小鲁班
1 parent
abe1aa82
feat(prop): add visible config
Showing
1 changed file
with
7 additions
and
1 deletions
front-end/h5/src/components/core/editor/edit-panel/props.js
| ... | ... | @@ -138,7 +138,13 @@ export default { |
| 138 | 138 | { |
| 139 | 139 | Object |
| 140 | 140 | .entries(props) |
| 141 | - .filter(([propKey, propConfig]) => propConfig.visible && propConfig.editor && !propConfig.editor.custom) | |
| 141 | + .filter(([propKey, propConfig]) => { | |
| 142 | + // 1. 如果开发者给 某个prop 显式指定了 visible 属性,则取开发者指定的值; | |
| 143 | + // 2. 否则取默认值:true,即默认在属性面板显示该属性 | |
| 144 | + // 3. 组件的某些属性是不需要显示在 配置编辑器的,比如:editorMode(编辑模式/预览模式),因为这个是鲁班编辑器默认注入到每个组件的,无须显示出来 | |
| 145 | + const isVisible = propConfig.hasOwnProperty('visible') ? propConfig.visible : true | |
| 146 | + return isVisible && propConfig.editor && !propConfig.editor.custom | |
| 147 | + }) | |
| 142 | 148 | .map(([propKey, propConfig]) => this.renderPropFormItem(h, { propKey, propConfig })) |
| 143 | 149 | } |
| 144 | 150 | </a-form> | ... | ... |