我的select代码如下
<q-select label="Select country"
behavior="menu"
:lazy-rules="true"
:rules="[val => !!val || 'Select your country']"
dense outlined v-model="form.code" :options="countries"
option-label="name" option-value="code">
</q-select>我有我的vuejs代码
<script>
export default{
data:()=>({
form:{
code:""
}
countries:[
{name:"Country-1", code:"+101"},
{name:"Country-2", code:"+201"},
]
})
}
<script>根据上面的代码,我希望form.code的值是代码,例如:+101,但是当我检查时,我发现这个值是完整的对象。我错过了什么,因为在我的选择中,我已经设置了选项标签和选项值,我错过了什么?
发布于 2020-07-14 04:57:28
您需要使用emit-value和map-options,请参阅:https://quasar.dev/vue-components/select#Affecting-model
https://stackoverflow.com/questions/62802286
复制相似问题