Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在
input
事件调用emitInputEvent
函数设置当前输入的值,在这个函数中将当前输入的字符记录到了reactData.inputValue
中。但由于props.immediate
默认为true
所以额外调用了一次emitModel(value, event)
,在emitModel
函数中又设置了一次reactData.inputValue
导致 BUG 触发。因为传递给emitModel
value 值是一个已经被Number
处理过的数值。如果输入了
3.
那么Number
处理过后就变成了3
而不是3.
或者3.0
。这个 PR 做了什么?
由于
VxeNumberInput
组件对外输出的数据是一个number
而组件内部需要 string 来记录当前输入状态。所以reactData.inputValue
就应该是input
组件的输入值而不是最终输出结果。因此不应该在emitModel
中直接设置它。该 PR 为
emitModel
添加了writeToInput = true
参数控制当前 emit 是否需要更新 input value。在emitInputEvent
函数中并不需要更新它。