Replies: 3 comments
-
無法監聽對象屬性的新增和刪除 let num = 3
const cat = {
name: '大橘',
sex: 'boy',
age: 5
}
Object.defineProperty(cat,'age',{
get() {
console.log('get value')
return num
},
set(val) {
console.log('set value', val)
num = val
}
})
cat.age = 6 // 可以被监听到
cat.breed = '狸花猫' // 无法被监听到 由於 可以看到數據無法被讀取到,從而無法實現數據的響應式,所以在
|
Beta Was this translation helpful? Give feedback.
-
針對今天投影片第19張:
Vue Core 源碼(baseHandler 155行): stackover-flow討論 (第一題): |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
slides 連結: https://docs.google.com/presentation/d/1scqeibi9ycTRpecdeNw336Sf_0YmdEs76cQ2N_j58bc/edit#slide=id.p
讀書會內容:
官網連結
Beta Was this translation helpful? Give feedback.
All reactions