You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functioncreateSetter(shallow=false){returnfunctionset(target: object,key: string|symbol,value: unknown,receiver: object): boolean{letoldValue=(targetasany)[key]// 省略代码...consthadKey=// 新增判断isArray(target)&&isIntegerKey(key)
? Number(key)<target.length
: hasOwn(target,key)constresult=Reflect.set(target,key,value,receiver)// don't trigger if target is something up in the prototype chain of originalif(target===toRaw(receiver)){if(!hadKey){trigger(target,TriggerOpTypes.ADD,key,value)}elseif(hasChanged(value,oldValue)){trigger(target,TriggerOpTypes.SET,key,value,oldValue)}}returnresult}}
The text was updated successfully, but these errors were encountered:
jizai1125
changed the title
《Vue.js设计与实现》5.4 合理的触发响应 - 新增内容
《Vue.js设计与实现》5.4 合理的触发响应
Sep 23, 2022
看源码时多了一种数组场景下的判断:不影响数组长度变化但是会触发副作用函数重新执行
PR: fix(reactivity): add existing index or non-integer prop on Array should not trigger length dependency
源码
The text was updated successfully, but these errors were encountered: