1 after reading the VUE source code for so many times, I know the observer mode + object.defineProperty data hijacking, dynamic monitoring data to render the page 2 so I write my own, I can understand more deeply, and I can find where I do not fully understand when I write. 3 spent two hours, intermittently changed several times, write out. The Watcher class corresponds to every {{}} node in HTML, because pages may have multiple nodes corresponding to the same attribute data. 7 Observer class corresponds to the attribute in data. 8 Compile class initializes and loads page elements, and parses the nodes corresponding to the data attribute through regular expression, and creates the corresponding watcher to add to the observer object
Finally achieve the function:
The code address
Github.com/shuihan03/l…