Vue Js v-model on v-select shows wrong value-PHP Chinese Network Q&A
Vue Js v-model on v-select shows wrong value
P粉697408921
P粉697408921 2023-08-30 16:52:46
0
1
358

There is some kind of bug on my v-select that causes v-model to display a different value than the actual value of the variable. I use a method to change the selected option that applies to the first change. For example, if I select False and flag = Y, the selected option changes to True, this works the first time you select the option, then when I change the value from True to False, it changes value, but the selected option is still false.

   

This is the method I use:

if(this.flag_member == 'N' && this.promo_form.generate_voucher == 'True'){ this.promo_form.promo_id = null; this.flag_member = ""; this.promo_form.generate_voucher = null; this.promo_form.voucher_type = ""; this.flag1 = 'y'; } else if(this.flag_member == 'Y' && this.promo_form.generate_voucher == "False"){ this.promo_form.generate_voucher = "True"; this.flag1 = 'n' } if(this.flag1 == 'y'){ alert('Something') } else if(this.flag1 == 'n'){ alert("Something") } 

I tried adding a label and the value is correct for the label but not for the v-model

P粉697408921
P粉697408921

reply all (1)
P粉473363527

In the method try changing this line

this.promo_form.generate_voucher = null
to
this.promo_form.generate_voucher = 'False'
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!