2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Nuxt3でvue-selectを入れたときのメモ

Last updated at Posted at 2023-08-13

初心者エンジニアの僕がnuxt3の練習中にvue-selectを使おうと思ったが、苦戦したので調べて動いた結果をメモ。

nuxt.js => 3.6.5
vue-select => 4.0.0-beta.6

追加したファイル・コード

Pluginディレクトリ

Plugins/vue-select.js  を作る

Plugins/vue-select.js  
import vSelect from 'vue-select';

export default defineNuxtPlugin((nuxtApp) => {
    nuxtApp.vueApp.component('v-select', vSelect);
})

nuxt.config.ts

nuxt.config.ts
export default defineNuxtConfig({
    css: ['vue-select/dist/vue-select.css'],
})

※cssがもとからある場合は、[]の中に,区切りで'vue-select/dist/vue-select.css'を追加する。

app.vue

app.vue
<template>
    <v-select :options="['a', 'b', 'c']"></v-select>
</template>

vue-select自体の書き方はこちらを参考
▶参考

2
2
1

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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?