LoginSignup
1
2

More than 5 years have passed since last update.

Vue.jsで階層が深い連想配列の中身をv-forでselect/optionで表示する

Last updated at Posted at 2018-12-09

連想配列で持たせたデータをv-forで取り出したいときは、こんな感じにする。
hoge.fugasには、apiでデータを取得したものが入っている想定。

index.html

<select>
    <option v-for="fuga in hoge.fugas" v-bind:value="fuga.key">
        {{fuga.value}}
    </option>
</select>
vue.js

var vue = new Vue({
    data: {
        hoge: {
            fugas: []
        }    
    }
})

Vue.js
フォーム入力バインディング

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