Ionic 我尝试使用v模型从离子选择中获取数据

gtlvzcf8  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(127)

使用v-for循环访问并获取选项。尝试将我的数据绑定到drinkName变量

<ion-select v-model='drinkName' placeholder="Drink Name">
      <ion-select-option
       v-for='drink, index in drinks'
       :key='index'
       :value="drink.name"
       >{{ drink.name }}
       </ion-select-option>
    </ion-select>
eulz3vhy

eulz3vhy1#

can you link your data drinkName pls ? And if you create a function in mounted If drinkName in console.log() is an Observer or object you need to stringify this. Exemple: JSON.parse(JSON.stringify(drinkName))

getValue() {
 console.log(drinkName)
}

相关问题