网上查了很多方法,没用。通过自己的瞎折腾。
首先定义一个数组:
private contacts:Array<{contact: string,email:string,phone:string }> = []; //用户联系人
赋值给它:
const contcatInfo={
contact:'',
email:'',
phone:''
} //定义一个空的JSON数据
然后push:
const index = this.contacts.push(contcatInfo);