fix: 文本过滤组件空默认值异常

This commit is contained in:
fit2cloud-chenyw 2022-01-28 11:40:42 +08:00
parent ac3fa4eca6
commit ccbd5eccc6
2 changed files with 7 additions and 2 deletions

View File

@ -64,7 +64,7 @@ export default {
},
created() {
if (this.element.options.value) {
this.value = this.element.options.value
this.value = this.fillValueDerfault()
this.search()
}
},

View File

@ -68,7 +68,7 @@ class TextInputServiceImpl extends WidgetService {
})
}
getParam(element) {
const value = element.options.value
const value = this.fillValueDerfault(element)
const param = {
component: element,
value: !value ? [] : Array.isArray(value) ? value : [value],
@ -76,6 +76,11 @@ class TextInputServiceImpl extends WidgetService {
}
return param
}
fillValueDerfault(element) {
const defaultV = element.options.value === null ? '' : element.options.value.toString()
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null
return defaultV.split(',')[0]
}
}
const textInputServiceImpl = new TextInputServiceImpl()
export default textInputServiceImpl