官术网_书友最值得收藏!

Reactive data properties

Another one of Vue's initialization steps is to walk through all of the data properties and assign them getters and setters. If you look in the following screenshot, you can see how each property in our current app has agetandsetfunction added to it:

Figure 2.9. Getters and setters

Vue added these getters and setters to enable it to perform dependency tracking and change notification when the properties are accessed or modified. So, when thecontractedvalueis changed by theclickevent, itsset method is triggered. Thesetmethod will set the new value, but will also carry out a secondary task of informing Vue that a value has changed and any part of the page relying on it may need to be re-rendered.

If you'd like to know more about Vue's reactivity system, check out the articleReactivity In Vue.js (And Its Pitfalls) athttps://vuejsdevelopers.com/2017/03/05/vue-js-reactivity/.

主站蜘蛛池模板: 巫山县| 中阳县| 乌海市| 北流市| 岐山县| 离岛区| 昆明市| 韶关市| 定远县| 西丰县| 松江区| 台南县| 昌乐县| 阿图什市| 商水县| 红河县| 泗阳县| 嘉禾县| 石渠县| 丹凤县| 平远县| 班玛县| 陇南市| 深圳市| 石狮市| 宽城| 凤台县| 合水县| 阳曲县| 麻栗坡县| 柏乡县| 迁西县| 东兰县| 海口市| 柯坪县| 宜黄县| 涞源县| 涿鹿县| 田东县| 商都县| 沧源|