If the data does not return to that field, how do I add it?

1.If the data returns is this.

 getProductList:[
          {
              productName:'Watermelon ',ProductPrice:100,PrductQty:1},{ProductName:'pumpkin',ProductPrice:50,PrductQty:2},{ProductName:'Apple',ProductPrice:300,PrductQty:3},]

2.If you want to determine if there is a checked field in the item, how do you judge and add it?
Overall situation

  if(typeof item.checked=='undefined'){
             Vue.set(item,"checked",true)//First determine whether this field does not exist, do not exist, add it, and add it globally.}else{Item.checked=! Item.checked / / here, according to actual needs.}

local

         if(typeof item.checked=='undefined'){
             this.$set(item,"checked",true)//First determine whether this field does not exist, does not exist, add it locally?}else{Item.checked=! Item.checked// here, according to actual needs.}

Leave a Reply

Your email address will not be published. Required fields are marked *