vue侦听器监听对象中属性的变化
<el-form-item label="油卡价格:" prop="petrolPrice"><el-select v-model="priceForm.petrolPrice" placeholder="油卡价格">//监听priceForm对象里面的petro
·
<el-form-item label="油卡价格:" prop="petrolPrice">
<el-select v-model="priceForm.petrolPrice" placeholder="油卡价格">//监听priceForm对象里面的petrolPrice属性的变化
<el-option v-for="item in priceData"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
data(){
return{
priceForm: {
petrolPrice: null,
withdrawableDiscount: null,
ordinaryDiscount: null,
telephoneDiscount: null
},
}
}
watch: {
"priceForm.petrolPrice": function(){ //加引号监听对象里的属性
this.getPetrolPrice();
this.setPriceDiscount();
}
},
更多推荐
已为社区贡献7条内容
所有评论(0)