TypeError: Cannot use 'in' operator to search for 'name' in false

Translation error: TypeError: can not use the "in" operator to search in the false "name"

The reason given: the use vue development, the object is assigned a binding input into false, and when the input value will be reported this wrong

<input type="text" v-model="form.name" />
getResult('xxx/xxx',params)
            .then((res)=>{
               this.form = res 
            })

Due to the background did not get to return a false value

 

 

 The reason is that within vue when parsing form the object, due to false is assigned a data type bindings have been changed,

Like the above translation as: you can not use the "in" operator to search in the false "name"

To solve this problem plus judgment

this.form = res ? res :{}

 

Guess you like

Origin www.cnblogs.com/bobo1/p/12381244.html