karol-f / vue-custom-element

Vue Custom Element - Web Components' Custom Elements for Vue.js
https://karol-f.github.io/vue-custom-element/
MIT License
1.97k stars 187 forks source link

Possible to use actions and router using custom element? #220

Open sepharg opened 4 years ago

sepharg commented 4 years ago

I´m trying to reuse a component that makes calls to the router i.e:

this.$route.params;

and I get an undefined when packing it into a vue-custom-element same thing happens for actions, i´m getting errors like

Error in mounted hook: "TypeError: Cannot read property 'params' of undefined"

or

TypeError: Cannot read property 'commit' of undefined

Any thoughts on this? Do i need to do something else in order to call $route in Vue, or define something when injecting Vuex context variables?