Skip to content

Commit

Permalink
fix: 修复属性面板中设置空字符串的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 committed Feb 19, 2024
1 parent 5e43b79 commit b525887
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/common/component/ConfigItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export default {
})
const updateValue = (value) => {
const { property } = props.property
const { property, type } = props.property
const { setProp } = useProperties()
// 是否双向绑定
Expand Down Expand Up @@ -283,7 +283,7 @@ export default {
}
if (props.isTopLayer) {
setProp(property, value)
setProp(property, value, type)
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/controller/src/useProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ const getProps = (schema, parent) => {
properties.parent = parent
}

const setProp = (name, value) => {
const setProp = (name, value, type) => {
if (!properties.schema) {
return
}

properties.schema.props = properties.schema.props || {}

if (value === '' || value === undefined || value === null) {
if ((value === '' && type !== 'String') || value === undefined || value === null) {
delete properties.schema.props[name]
} else {
properties.schema.props[name] = value
Expand Down

0 comments on commit b525887

Please sign in to comment.