Quasar framework q-select sets an object in the v-model than the id

I have the following code for my 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>

And my vuejs code i have

<script> export default{ data:()=>({ form:{ code:"" } countries:[ {name:"Country-1", code:"+101"}, {name:"Country-2", code:"+201"}, ] }) } <script>

From the above i expect the value of form.code to be the code eg: +101 but when i check i find the value is the full object. What am i missing since on my select i have already set the option-label and option-value What am i missing?

2 Answers

You need to use emit-value and map-options, see:

0

Currently way to that with your custom object name is too override, see

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like