vue计算监听事件的高级设计

computed: {
    
    
//复合肥钾含量
			'compoundFertilizer2.potassiumTotal':{
    
     
				get(val){
    
       
						if(!Number(val.compoundFertilizer2.potassiumTotal)){
    
    
							return  parseFloat(val.compoundFertilizer2.potassiumTotal);
						}else{
    
     
							if(val.compoundFertilizer2.potassiumTotal<=100 && val.compoundFertilizer2.potassiumTotal>0){
    
    
								this.potassiumTotalchangeVal=val.compoundFertilizer2.potassiumTotal;
							}
							if(val.compoundFertilizer2.potassiumTotal>100 || val.compoundFertilizer2.potassiumTotal<0){
    
    
								this.compoundFertilizer2.potassiumTotal=this.potassiumTotalchangeVal;
								return  this.potassiumTotalchangeVal;
							} 
						} 
						
					}
			},
		}

猜你喜欢

转载自blog.csdn.net/weixin_45932157/article/details/125016559