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

How to use vuex store with typescript #161

Closed
ujjwalguptaofficial opened this issue Apr 10, 2019 · 1 comment
Closed

How to use vuex store with typescript #161

ujjwalguptaofficial opened this issue Apr 10, 2019 · 1 comment
Assignees

Comments

@ujjwalguptaofficial
Copy link

ujjwalguptaofficial commented Apr 10, 2019

I was able to convert my app into custom component by using below code -

Vue.customElement('my-app', new Main().$options);

Here Main is component & Main has multiple nested child components.
but dont know where to add the store.

Here is the initiate code -

// Initiate vue app
var vue_app = new Vue({
    el: '#app',
    store: store,
    render: h => h(Main)
});

please let me know. THanks.

@karol-f
Copy link
Owner

karol-f commented Apr 10, 2019

import Main from './Main.vue';
import store from './store';

const MainComponent = new Main().$options
MainComponent.store = store
Vue.customElement('my-app', MainComponent);

or similar usage usage should work fine. Feel free to comment if something is not working. Regards!

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