【问题标题】:How to display the value of select option on value input text ? (vue.js 2)如何在值输入文本上显示选择选项的值? (vue.js 2)
【发布时间】:2017-06-28 12:27:07
【问题描述】:

我的代码是这样的:

<div id="demo">
  <div>
    <select class="form-control" v-model="selected" required>
      <option v-for="option in options" v-bind:value="option.id">{{ option.name }}</option>
    </select>
    {{selected}}
  </div>
</div>

<input type="text" :name="elementName" v-model="{{selected}}">

在此处查看完整代码:https://fiddle.jshell.net/stvct9er/1/

在组合框上选择后,我想在输入文本上显示选择选项的值

我尝试像上面的代码。但它不起作用

请帮我解决我的问题

【问题讨论】:

    标签: javascript jquery vue.js vuejs2 vue-component


    【解决方案1】:

    你需要在演示 div 中移动输入,因为这是安装点,

    v-model 只需使用引号 &lt;input type="text" v-model="selected"&gt;

    https://fiddle.jshell.net/stvct9er/2/

    【讨论】:

      猜你喜欢
      • 2017-06-28
      • 1970-01-01
      • 2017-06-29
      • 1970-01-01
      • 1970-01-01
      • 2019-07-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-21
      相关资源
      最近更新 更多