Ionic-framework: bug: Vuex not working with ion-modal

Created on 8 Jul 2019  路  3Comments  路  Source: ionic-team/ionic-framework

When using this.$ionic.modalController to launch a modal, the component's this.$store isn't set.

Here is the error thrown by this.$store.state:

TypeError: Cannot read property 'state' of undefined

stale issue vue

Most helpful comment

I think it applies to basically all libs. I solved by importing those in the modal component.

import store from '../store';
import router from '../router';
export default {
    store,
    router,
    // ...
}

All 3 comments

Same goes to vue-i18n, eg: this.$t('message.hello', { msg: 'hello' }) cannot be used in a modal:

"TypeError: Cannot read property '_t' of undefined"

I think it applies to basically all libs. I solved by importing those in the modal component.

import store from '../store';
import router from '../router';
export default {
    store,
    router,
    // ...
}

Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandyscarney picture brandyscarney  路  3Comments

masimplo picture masimplo  路  3Comments

manucorporat picture manucorporat  路  3Comments

daveshirman picture daveshirman  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments