简体   繁体   English

select 标签的渲染选项为空,但生成的选项数量与数据源计数相同 VUE / IONIC

[英]Rendered options for select tag are blank BUT quantity of generated options is the same with data source count VUE / IONIC

I want render an options for select tag using v-for directive in Ionic / Vue.我想在 Ionic / Vue 中使用 v-for 指令呈现 select 标签的选项。 It looks like a data source have a good communication with component, but v-for is genering a blank options.看起来数据源与组件的通信良好,但 v-for 生成了一个空白选项。 Link is here: https://ibb.co/Vjv0dfb链接在这里: https://ibb.co/Vjv0dfb

<div style="text-align: center; margin-top:30px; ">
  <select id="secondParamSelect" style="width:300px; margin-left:50px;">
    <option v-bind:="selecteds" v-for="option in options" :key="option.name" style="color:black;"></option>
  </select>
  <ion-label >{{selecteds}}</ion-label> 
</div>

Here is an export part:这是导出部分:

data(){
  return{
    selecteds: '',
    options: [
      {name: 'Foo'},
      {name: 'Boo'},
      {name: '3rd'},
    ],
  }
  },

There were some word missing in your code.您的代码中缺少一些单词。 i have made the changes and the output is as described by you.我已经进行了更改,output 与您描述的一样。 Also u have use v-bind in select tag as a v-model...您还使用 select 标签中的 v-bind 作为 v-model ...

<div style="text-align: center; margin-top:30px; ">
  <select style="width: 300px; margin-left: 50px" v-model="selecteds">
        <option
          v-for="option in options"
          :key="option.name"
          style="color: black"
        >
          <!-- Changes -->
          {{ option.name }}
        </option>
      </select>
  <ion-label >{{selecteds}}</ion-label> 
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM