Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to add mobx to vue plugin component inside Vue.component, Vue.extend install function? #87

Open
ColtHands opened this issue Feb 3, 2022 · 1 comment
Assignees

Comments

@ColtHands
Copy link

Basically i want to add my state globally through install fn, but I can't seem to find any examples.

export default {
    install(Vue, options) {
        // this will work, but wont be observable by component
        Vue.prototype.state = new StateClass()

        // I want to add mobx on this step, state above will work, but wont be observable
        Vue.component('MyCustomComponent', Vue.extend(MyCustomComponent))
    }
}
@ColtHands
Copy link
Author

I've tried multiple things but i can't seem to find a way to define mobx-vue globally. Are there any examples like that?

new Vue({
  components: ...,
  state: new ViewModel()
}).mount("#app")
  

@iChenLei iChenLei self-assigned this Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants