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

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

主站蜘蛛池模板: 霍林郭勒市| 安平县| 吉木乃县| 盖州市| 芜湖市| 钟山县| 资源县| 陇川县| 贺州市| 旬阳县| 樟树市| 嘉祥县| 和平区| 塔城市| 苍溪县| 康平县| 梧州市| 荥经县| 道真| 梅州市| 昭平县| 重庆市| 临泽县| 漳州市| 淳安县| 瑞昌市| 哈密市| 澎湖县| 常熟市| 青田县| 平乡县| 安徽省| 垣曲县| 峨眉山市| 海门市| 晋中市| 尉犁县| 哈尔滨市| 新竹县| 晋江市| 屏南县|