我想根据选择(“答复”或“拒绝”)对“提交”按钮执行操作,但是我无法获得“答复”或“拒绝”值,该怎么做?
<select class="dropdown">
<option value=""><label>- Select -</label></option>
<option value="Reply" v-model="Reply_User">Reply</option>
<option value="Reject" v-model="Reject_User">Reject</option>
</select>
</div>
<div id="app" class="reply_report">
<div class="reply_send">
<b @click="submit"> Send </b>
</div>
答案 0 :(得分:1)
不是将v模型提供给选项标签,而是在select标签上设置v模型。这可能对您有用。
new Vue({
el: "#app",
data: {
select: ''
},
methods: {
submit(){
console.log(this.select)
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<select class="dropdown" v-model="select">
<option value=""><label>- Select -</label></option>
<option value="Reply">Reply</option>
<option value="Reject">Reject</option>
</select>
<div id="app" class="reply_report">
<div class="reply_send">
<button @click="submit"> Send </button>
</div>
</div>
</div>