提交 77445489 编写于 作者: Q qiang

fix: input value null

上级 a0c1d1d7
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
}, },
data () { data () {
return { return {
inputValue: this.value + '', inputValue: this._getValueString(this.value),
composing: false, composing: false,
wrapperHeight: 0, wrapperHeight: 0,
cachedValue: '' cachedValue: ''
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
value && this._focusInput() value && this._focusInput()
}, },
value (value) { value (value) {
this.inputValue = value + '' this.inputValue = this._getValueString(value)
}, },
inputValue (value) { inputValue (value) {
this.$emit('update:value', value) this.$emit('update:value', value)
...@@ -255,6 +255,9 @@ export default { ...@@ -255,6 +255,9 @@ export default {
value: this.inputValue, value: this.inputValue,
key: this.name key: this.name
} : {} } : {}
},
_getValueString (value) {
return value === null ? '' : String(value)
} }
} }
} }
...@@ -295,7 +298,7 @@ uni-input[hidden] { ...@@ -295,7 +298,7 @@ uni-input[hidden] {
} }
.uni-input-placeholder, .uni-input-placeholder,
.uni-input-input{ .uni-input-input {
width: 100%; width: 100%;
} }
......
...@@ -119,7 +119,7 @@ export default { ...@@ -119,7 +119,7 @@ export default {
}, },
data () { data () {
return { return {
valueSync: String(this.value), valueSync: this._getValueString(this.value),
valueComposition: '', valueComposition: '',
composition: false, composition: false,
focusSync: this.focus, focusSync: this.focus,
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
}, },
watch: { watch: {
value (val) { value (val) {
this.valueSync = String(val) this.valueSync = this._getValueString(val)
}, },
valueSync (val) { valueSync (val) {
if (val !== this._oldValue) { if (val !== this._oldValue) {
...@@ -296,6 +296,9 @@ export default { ...@@ -296,6 +296,9 @@ export default {
}, },
_resetFormData () { _resetFormData () {
this.valueSync = '' this.valueSync = ''
},
_getValueString (value) {
return value === null ? '' : String(value)
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册