javascript - How does vue listen to the change event to implement two-way binding?
代言
代言 2017-06-30 09:59:10
0
3
1002

We use native events to listen to an input box and bind such an event when it changes. The condition for the execution of this callback function is after the input box is blurred

el.addEventListener('change', function(e){
    console.log(e.target.value);
})

But frameworks such as Vue.js and React.js do not require blur to trigger the callback function for the input bound to the change event. Instead, each real-time input will trigger the callback, just like IE's onpropertychange event.

How is this done?

代言
代言

Popular Tutorials
More>
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!