Strve.js implements simple two-way data binding

Anyone who has used Vue knows that the v-model directive can implement two-way data binding. Two-way binding In addition to data-driven DOM, DOM changes in turn affect the data, is a two-way relationship.

So let's use Strve.js to implement it today, less than 30 lines of code.

Source code:

640.png

Effect:

640.gif

Github

github.com/maomincodin…

Guess you like

Origin juejin.im/post/7100938652481486879