摘要: 通过Object.defineProperty实现了对对象属性的监听,但是Object.defineProperty对数组已有元素也是实现监听的,那么为什么vue中没有提供这一功能,使得arr[已有元素下标]=val变成响应式 Object.defineProperty 可以做到对数组的监听,它是支 阅读全文
posted @ 2022-01-10 17:30 瑞瑞大人 阅读(418) 评论(1) 推荐(0) 编辑
摘要: function set(target: Array<any> | Object, key: any, val: any): any { // isUndef 是判断 target 是不是等于 undefined 或者 null 。 //isPrimitive 是判断 target 的数据类型是不是 阅读全文
posted @ 2022-01-10 15:52 瑞瑞大人 阅读(71) 评论(0) 推荐(0) 编辑