1
1

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 3 years have passed since last update.

Vuetify でフィルタリング機能付きセレクトボックスを実装する

Posted at

Vuetifyのv-autocompleteを利用して絞り込み機能付きのセレクトボックスを実装します。

vueでの記述は下記のようになります

page.vue
<v-autocomplete
    :items="users"
    item-value="id"
    item-text="name"
    placeholder="ユーザーを選択してください"
    v-model="user"
    autocomplete="off"
>
</v-autocomplete>

methodは以下のようになります

page.vue
  data() {
    return {
      users: []
    };
  },
  methods: {
    userListLoad() {
      axios.get('https://example.com/users')
        .then(
          result => {
            Object.entries(result.users).forEach(user =>
              this.users.push({ name: user["name"], id: user["id"] })
            );
          },
          err => {
            console.log(err);
          }
        );
    },
  },

かんたんですね。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?