From 7a145d86430bad65271f4d6ab1344b215fefe52a Mon Sep 17 00:00:00 2001 From: Piotr Kaminski Date: Fri, 23 Mar 2018 16:08:02 -0700 Subject: [PATCH] fix(observer): invoke getters on initial observation if setter defined (#7828) --- src/core/observer/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/observer/index.js b/src/core/observer/index.js index 4a030ed7f9..35469aaf16 100644 --- a/src/core/observer/index.js +++ b/src/core/observer/index.js @@ -147,10 +147,10 @@ export function defineReactive ( // cater for pre-defined getter/setters const getter = property && property.get - if (!getter && arguments.length === 2) { + const setter = property && property.set + if ((!getter || setter) && arguments.length === 2) { val = obj[key] } - const setter = property && property.set let childOb = !shallow && observe(val) Object.defineProperty(obj, key, {