目录

VUE中再后端的数组中添加新的字段

目录

VUE中再后端的数组中添加新的字段

后端返回一个数组例如

list:[
	{
		name:"1",
		age:"2"
	},
	{
		name:"3",
		age:"4"
	},
	{
		name:"5",
		age:"6"
	},
]

你想给数组里面添加一个time字段,可以使用$set()例子如下

this.$set(this.list,'time','2021-11-9')
this.list代表后端返回来的数组 time 是key值 2021-11-9  value