javascript - How to actively trigger the change event of the checkbox component in the ElementUI library of Vue.js?
伊谢尔伦
伊谢尔伦 2017-06-28 09:23:06
0
3
2428

Work on a project and encounter an actual scenario.
First level: a checkbox_1 (for example, bound to the change event method cevt1). After triggering, select all items in the second-level checkboxgroup (normal use) .

The problem is, when checkbox_2 of the checkboxgroup in the second level (for example, the checkbox of the sub-level is bound to the change event method cevt2) is selected, it should normally trigger all checkbox_3 selected in the corresponding checkboxgroup of the third level. ,

In fact, when checkbox_1 in the first level is triggered, cevt1 is triggered normally, but it is found that the change event cevt2 bound to checkbox_2 in the "second level" has not been called. Is there any solution?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
伊谢尔伦

Vue's change method seems to only respond to data changes caused by clicks and v-bind data binding. Other data changes will not trigger the change event. You can try to use the $emit method to manually call checkbox_2's change event.

See:
https://cn.vuejs.org/v2/api/#...

世界只因有你

Try using watch to listen for changes in the value bound to the checkbox

给我你的怀抱

/q/10... Can you give a more detailed answer to this post? What is stored in the store from the router? ? Newbie

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!