Environment
macOs 10.12.6/Chrome 68.0.3440.106/Vue2.5.17
Reproduction link
https://jsfiddle.net/pu5r870m/2/
Steps to reproduce
运行代码就好,查看控制台的输出
What is expected?
首次设置v-model绑定的值的时候,不要触发on-change事件
What is actually happening?
当设置Select组件为多选的时候,给v-model绑定的变量设置一个初始值时,on-change事件触发了
2条答案
按热度按时间bbuxkriu1#
Translation of this issue:
Environment
MacOs 10.12.6/Chrome 68.0.3440.106/Vue2.5.17
Reproduction link
https://jsfiddle.net/pu5r870m/2/
Steps to reproduce
Run the code well, check the console output.
What is expected?
Do not trigger on-change events when setting the value of the V-model binding for the first time.
What is actually happening?
The on-change event triggers when the Select component is set to be multi-select and an initial value is set for the variable bound to the V-model
mctunoxg2#
这个地方应该始终不等吧,虽然数组的值是相等的,但不是同一个数组,所以总会触发on-change事件