将dataTemp值根据type值不同赋给不同的数组如allData,inData,outData
if (this.type == 0){ this.allData = dataTemp || []; }else if (this.type == 1){ this.inData = dataTemp || []; }else if (this.type == 2){ this.outData = dataTemp || []; }
switch (this.type){ case 0: this.allData = dataTemp || []; break; case 1: this.inData = dataTemp || []; break; case 2: this.outData = dataTemp || []; break; }
let _self = this; const dataList = ['allData', 'inData', 'outData',]; dataList.forEach(function (key, index) { _self[key] = index === _self.type ? dataTemp : [] });
let _self = this; let objTemp = { '0':_self.allData, '1':_self.inData, '2':_self.outData }; objTemp[_self.type] = dataTemp || [] _self['allData']= _self.type == 0 ? objTemp[_self.type] : []; _self['inData']= _self.type == 1 ? objTemp[_self.type] : []; _self['outData']= _self.type == 2 ? objTemp[_self.type] : [];