如何使用以下数据创建下拉菜单?

问题描述 投票:0回答:1

如何使用以下数据创建下拉列表,并将其与Vue.js配对并从数据库中收集数据?

    <div class="form-group">
        <label for="pen-id">Pen Id:</label>
        <input type="text" id="pen-id" class="form-control" v-model="trainManual.PenId">
    </div>
html database vue.js dropdown
1个回答
0
投票

如果您只想使用html,请在html的select选项标签中使用v-for,像这样

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

但是最好使用bootstrap vue

enter link description here

© www.soinside.com 2019 - 2024. All rights reserved.