Просмотр исходного кода

call getters and methods on instance

Evan You 9 лет назад
Родитель
Сommit
d5bab78059
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/override.js

+ 2 - 2
src/override.js

@@ -20,7 +20,7 @@ export default function (Vue) {
         options.computed = options.computed || {}
         Object.keys(state).forEach(key => {
           options.computed[key] = function vuexBoundGetter () {
-            return state[key](this.$store.state)
+            return state[key].call(this, this.$store.state)
           }
         })
       }
@@ -29,7 +29,7 @@ export default function (Vue) {
         options.methods = options.methods || {}
         Object.keys(actions).forEach(key => {
           options.methods[key] = function vuexBoundAction (...args) {
-            return actions[key](this.$store, ...args)
+            return actions[key].call(this, this.$store, ...args)
           }
         })
       }