iview select 二级联动 对象

仅作参考,正在寻求更好的
#图例
在这里插入图片描述
#给后台数据类型
{
“a”:“感冒药”,
“b”:“1”
}
{
“a”:“阿司匹林”,
“b”:“1”
}
#代码


		


		

//script
drug:{
	get() {
		    return this.drug ? this.drug.value : {}
		},
		set(value) {					
			this.drugSelectChange()
			if(value == 1){
				this.drugChangeList = this.medicineTraditionalList
			}else if(value == 2){
				this.drugChangeList = this.newMedicineList
			}else if(value == 3){
				this.drugChangeList = this.otherMedicineList
			}
			this.det = value
		    this.drug = this.drugList.find(item => {
		        return value == item.value
		    })
		}
	},
	drugChangeExt:{
		get() {
		    return this.drugChange ? thisdrugChange.value : {}
		},
		set(value) {
			if(value){
				this.drugChange = this.drugChangeList.find(item => {
					return value == item.value
				})
				if(this.det== 1){
					this.medicineTraditional = this.drugChange
				}else if(this.det== 2){
					this.treatProcess.newMedicine = this.drugChange
				}else if (this.det== 3){
					this.treatProcess.otherMedicine = this.drugChange
				}					
			}
		}
	},

你可能感兴趣的:(iview,iview,vue,两级联动,select)