Vue set method of changing the content of the object and the array

Vue.set(vm.userInfo,'address','beijing');

Method one: using the global set method

vm.$set(vm.userInfo,"address","beijing");

Method two: $ set using the method of Example vue

 

 

 

Array operations:

Vue.set (vm.arr, 1,5) // 1 is a subscript, the modified content of 5
vm.$set(vm.arr,1,5)

 

Guess you like

Origin www.cnblogs.com/em2464/p/12325663.html