Troubleshooting
This guide covers some of the more common issues you may run into when developing with Ionic Vue.
Have an issue that you think should be covered here? Let us know!
#
Failed to resolve componentIf you see this warning, then it is likely you did not import your component from @ionic/vue
. By default, all Ionic Vue components are locally registered, meaning you need to import them each time you want to use them.
Without importing the component, you will only get the underlying Web Component, and Vue-specific features such as v-model
will not work.
To resolve this issue, you need to import the component from @ionic/vue
and provide it to your Vue component:
Prefer to register your components globally once? We have you covered. Our Optimizing Your Build Guide shows you how to register Ionic Vue components globally as well as the potential downsides to be aware of when using this approach.
#
Slot attributes are deprecatedThe slots that are used in Ionic Vue are Web Component slots, which are different than the slots used in Vue 2. Unfortunately, the APIs for both are very similar, and your linter is likely getting the two confused.
All Ionic Vue starters ship with this rule turned off, but you can do it yourself by adding the following to your .eslintrc.js
file:
If you are using VSCode and have the Vetur plugin installed, you are likely getting this warning because of Vetur, not ESLint. By default, Vetur loads the default Vue 3 linting rules and ignores any custom ESLint rules.
To resolve this issue, you will need to turn off Vetur's template validation with vetur.validation.template: false
. See the Vetur Linting Guide for more information.
#
Method on component is not a functionIn order to access a method on an Ionic Framework component in Vue, you will need to access the underlying Web Component instance first:
In other framework integrations such as Ionic React, this is not needed as any ref
you provide is automatically forwarded to the underlying Web Component instance. We are unable to do the same thing here due to limitations in how Vue manages refs.
See the Quickstart Guide for more information.
#
Page transitions are not workingIn order for page transitions to work correctly, each page must have an ion-page
component at the root:
See the IonPage documentation for more information.