//对象的属性sex的值更新为"男" let obj = {name:"六四",age:18,sex:"女"} this.$set(obj,"sex","男") //第一个参数是对象,第二个参数是更新的属性名称,第三个参数是新的内容 //更新之后的obj是 {name:"六四",age:18,sex:"男"}
let arr = ["星期一","星期二","星期日"] this.$set(arr,2,"星期三") //第一个参数是数组,第二个参数是下标索引,第三个参数是新的内容 //更新之后的arr是["星期一","星期二","星期三"]
标签:arr,set,obj,更新,sex,参数,使用,方法 From: https://www.cnblogs.com/qiangyanhuanxiao/p/17646705.html