[Vue warn]: Error in callback for watcher “value“: “Value should be trueValue or falseValue.“

insert image description here
Using the CheckBox component of iview in a modal box, the above error occurs in the console, the code is as follows:

// modal框内

<Checkbox v-model="formValidate.adress" :true-value="1" :false-value="0"></Checkbox> 

//js
 data () {
    
    
   return {
    
    
       formValidate: {
    
    
           name: '',
           adress: 0,
       },
   }
}

Solution:
At first glance, there is nothing wrong with this, but here you need to pay attention to formValidate.adresswhether this is in other places 被赋值or 被改变, especially, it has been changed 其他数据类型!

Of course, this is the case here. My adress was blanked when the modal box was closed, and changed to 0. Just nullreassign and change it to 0.

Guess you like

Origin blog.csdn.net/weixin_52443895/article/details/129385295