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

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

主站蜘蛛池模板: 上饶县| 四会市| 景泰县| 龙游县| 斗六市| 文化| 于田县| 青岛市| 吴旗县| 丰顺县| 德惠市| 施秉县| 固镇县| 九台市| 黄梅县| 天津市| 阳信县| 名山县| 太康县| 桑日县| 开鲁县| 临沂市| 赫章县| 乳源| 涞水县| 绍兴市| 安庆市| 开封县| 郓城县| 来凤县| 六盘水市| 嘉黎县| 商洛市| 武义县| 满洲里市| 新巴尔虎右旗| 工布江达县| 比如县| 钦州市| 牡丹江市| 涡阳县|