Przeglądaj źródła

refactor: set should return early if original def has getter but no setter (#7981)

HcySunYang 7 lat temu
rodzic
commit
6e5909869c
1 zmienionych plików z 2 dodań i 0 usunięć
  1. 2 0
      src/core/observer/index.js

+ 2 - 0
src/core/observer/index.js

@@ -179,6 +179,8 @@ export function defineReactive (
       if (process.env.NODE_ENV !== 'production' && customSetter) {
         customSetter()
       }
+      // #7981: for accessor properties without setter
+      if (getter && !setter) return
       if (setter) {
         setter.call(obj, newVal)
       } else {