<div>
  <select v-model="selected">
    <option v-for="opt in options" v-bind:value="opt.value">{{opt.text}}</option>
  </select>
  <br>
  <span>Selected: {{ selected }}</span>
</div>

var options = [
  { text: 'A-label', value: 'A' },
  { text: 'B-label', value: 'B' },
  { text: 'C-label', value: 'C' }
];
new Vue({
  el: '#app',
  data: {
    selected: 'A',
    options: []
  },
  created: function(){
    this.options = options;
  }
})
Logo

前往低代码交流专区

更多推荐