From 45e21206ef16501dac89aae7ef8e3b7c453ac427 Mon Sep 17 00:00:00 2001 From: Alexander Heimbuch Date: Tue, 9 Oct 2018 20:54:18 +0200 Subject: [PATCH] fix(mapstate): Fixes mapstate on component binding --- README.md | 6 +++--- src/mixin.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cf0c302..a821a76 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,10 @@ export default { name: 'My Vue Component', data () { return { - baz: 10 + baz: 10, ...this.mapState({ - baz: function (state) { - return state.bar + this.baz //maps state.bar + 10 to data.baz + foo: function (state) { + return state.bar + this.baz //maps state.bar + 10 to data.foo } }) } diff --git a/src/mixin.js b/src/mixin.js index a64bfa0..e5fac20 100644 --- a/src/mixin.js +++ b/src/mixin.js @@ -21,7 +21,7 @@ export const connect = ({ Vue, store, actions = {} }) => { this.store = store this.$$actions = actions - this.mapState = (...props) => mapState(props).call(this) + this.mapState = (...props) => mapState(...props).call(this) }, created () { // Root component should not interact with the store