这是代码...
sendData(inp1:Element){
this.ele.push(inp1['value'])
this.outData.emit(this.ele);
console.log(this.ele);
this.ele += inp1['value'];
inp1['value'] = "";
}
安慰: [";rjg"]
错误类型错误:this.ele.push 不是一个函数
如果this.ele
没有初始化,那么用空数组初始化它,因为push
只处理数组
试试这个:
sendData(inp1:Element){
if (typeof this.ele == 'undefined') {
this.ele = []
}
this.ele.push(inp1['value'])
this.outData.emit(this.ele);
console.log(this.ele);
this.ele += inp1['value'];
inp1['value'] = "";
}