在上述代码的基础上,增加失去焦点时,将输入的值除以100:

<el-input v-on:input="item.supplierAnnualReductionRate = item.supplierAnnualReductionRate.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1')"
          style="width: 90%;"
          :min="0"
          :disabled="userStore.name != props.bpmTarget || props.taskOperateType != 1"
          v-model="item.supplierAnnualReductionRate"
          placeholder="供应商年降比例"
          @change="changeCustomerRate($event, item, index)"
          @blur="item.supplierAnnualReductionRate = item.supplierAnnualReductionRate / 100" />

在上述代码中,通过添加 @blur 事件,当输入框失去焦点时,将 item.supplierAnnualReductionRate 的值除以100。这样,输入框中输入的值就会自动除以100。

在此基础上增加 失去焦点 值除100 el-input v-oninput=itemsupplierAnnualReductionRate = itemsupplierAnnualReductionRatereplace^0-9g replaceg $1 style=width 90; min=0 disabled=userStorename != propsbpmTarget propstas

原文地址: https://www.cveoy.top/t/topic/jeBI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录