<!-- 添加双向绑定属性用于监听输入,再通过@input实时输入,将该属性所在下标传到该函数里 -->
<input v-model="spec.price" @input="specPrice(sIndex)" id="spec-price" class="ns-input" type="text" placeholder="请输入价格">
// 监听规格价格
specPrice(index){
// 通过下标进行本地监听,实时更新
this.$watch(() => this.specs[index].price,(newVal) => {
// 正则判断允许正整数后两位小数点
this.specs[index].price = manage.regular(newVal,0).val;
})
},