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

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/.

主站蜘蛛池模板: 遵化市| 上高县| 兴海县| 嘉黎县| 恭城| 长海县| 安化县| 霍山县| 宜都市| 上犹县| 霍邱县| 中卫市| 潮安县| 中牟县| 永泰县| 和龙市| 大洼县| 惠水县| 永兴县| 庄浪县| 纳雍县| 南平市| 开远市| 绥棱县| 山东| 凤阳县| 赣榆县| 墨竹工卡县| 邓州市| 玛曲县| 满城县| 黄冈市| 佛冈县| 济源市| 宜黄县| 塔河县| 临猗县| 辽宁省| 巨野县| 堆龙德庆县| 嘉兴市|