【小程序】给对象增加元素,增加一条数据

给对象的属性赋值,然后把这条数据push进去 

let answer = this.data.answer;

var obj = new Object();

obj.content='111';

obj.score="30";

console.log(obj)

answer.push(obj);

console.log(answer)       

this.setData({

    answer: answer

})

猜你喜欢

转载自blog.csdn.net/qq_33338352/article/details/105192345