ktsn / vuex-class

Binding helpers for Vuex and vue-class-component
MIT License
1.73k stars 86 forks source link

Seems src/bindings#extractNamespace behaviour is not expected #31

Closed bolasblack closed 6 years ago

bolasblack commented 6 years ago

Hi, I'm reading the code, and I found the code in function extractNamespace

https://github.com/ktsn/vuex-class/blob/ddefbb3f125f174beb3678067423bf4a2966f412/src/bindings.ts#L128-L130

will append / to the tail of namespace.

So if I call @State('name', { namespace: 'userInfo' }), it will execute mapState('userInfo/', { [...]: 'name' })

I think this isn't what I expected.

Did I missed any thing?

ktsn commented 6 years ago

Why doesn't it expected? It would bind to userInfo namespace.

bolasblack commented 6 years ago

I'm so sorry to reply so late. I used to be too busy in the past to have the energy to check the code.

At last I found it's my fault, the vuex version I am using is too old to work with newest vuex-class.

In 2.0.0 vue use this.$store.state[val] to search namespace, so I think the argument vuex-class generated may wrong:

https://github.com/vuejs/vuex/blob/cca2c4b19b7656ea4632d47c39640da68d94c239/src/helpers.js#L7

Just now I found newest vuex has changed the way to search namespace:

https://github.com/vuejs/vuex/blob/e821f1bf5b818992d7f34c03029ce2ded1f52a75/src/module/module-collection.js#L16-L22

Now my problem has resolved. Thanks for your work :P

And apologize again for my recklessness.