
//this.deductTypeList 为Vm实例中 data()中属性:deductTypeList :[]
let deductType=“1|3”;
let deductTypesArray=deductType.split("|");
//初始化数组,哈 百度了下 发现这是最直接的:删除所有数组索引的方式
let deductTypeList2=[];
this.deductTypeList=deductTypeList2;
for(let i in deductTypesArray){
if(deductTypesArray[i]=="1"){
let deductTypeArray={
value:"1",
label:"天数减免"};
this.deductTypeList.push(deductTypeArray);
}else if(deductTypesArray[i]=="2"){
let deductTypeArray={
value:"2",
label:"金额减免"};
this.deductTypeList.push(deductTypeArray);
}else if(deductTypesArray[i]=="3"){
let deductTypeArray={
value:"3",
label:"期次减免"};
this.deductTypeList.push(deductTypeArray);
}
//整个循环下来后, this.deductTypeList数组就是根据后台返回值,动态出的下拉属性了。用于<el-select>标签中