1
0

More than 1 year has passed since last update.

VueでIonicons利用時に"Unknown custom element"エラーが出る場合の対処法

Last updated at Posted at 2020-04-19

Vueの開発バージョンでIoniconsを利用すると、コンソールに下記のようなUnknown custom elementのエラーが表示されます。

[Vue warn]: Unknown custom element: <ion-icon> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

(found in <Root>)

compilerOptions.isCustomElementでカスタム要素であることを認識させると解決します。

const app = createApp({});
app.config.compilerOptions.isCustomElement = tag => tag.startsWith('ion-');
app.mount('#app');

Vue2での方法

ignoredElementsion-iconを設定することでVueがIoniconに対してエラーを出さないようにできます。

Vue.config.ignoredElements = ['ion-icon'];

new Vue({
...

参考文献

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0