销售型网站设计,word期刊排版模板,网页制作背景图片设置,网站备案要营业执照原件吗在input事件拿到用户输入的值#xff0c;然后给input组件绑定的值赋值之前#xff0c;判断用户输入的不能超过最大值#xff0c;超过的话默认为100#xff0c;#xff0c;这个判断和赋值然后视图更新只能触发一次#xff0c;之后在输入#xff0c;发现值改了页面但是不更…在input事件拿到用户输入的值然后给input组件绑定的值赋值之前判断用户输入的不能超过最大值超过的话默认为100这个判断和赋值然后视图更新只能触发一次之后在输入发现值改了页面但是不更新。我擦了v-model和value都试过。都没用网上描述的这个bug能追溯到19年。看来是个老bug。解决办法就是将赋值代码写在延时器中
$set也试过 没有用
inputfomatter(val) {//input事件函数console.log(input事件);this.questList[this.questIndex].options[0].value Number(val.target.value)if (val.detail.value.length 0) { //清除按钮显隐this.showClearIcon true;} else {this.showClearIcon false;}if (Number(val.target.value) this.questList[this.questIndex].rulerMinValue) { //如果用户输入的值小于最小值,则赋值为最小值setTimeout(() { this.questList[this.questIndex].options[0].value this.questList[this.questIndex].rulerMinValue }, 0) //不这么写输入的超过最大值只能重置一次之后虽重置了值但是页面不更新// this.questList[this.questIndex].options[0].value this.questList[this.questIndex].rulerMinValue}if (Number(val.target.value) this.questList[this.questIndex].rulerMaxValue) { //如果用户输入的值大于最大值,则赋值为最大值setTimeout(() { this.questList[this.questIndex].options[0].value this.questList[this.questIndex].rulerMaxValue }, 0)// this.questList[this.questIndex].options[0].value this.questList[this.questIndex].rulerMaxValue// this.$set(this.questList[this.questIndex].options[0], value, this.questList[this.questIndex].rulerMaxValue)}setTimeout(() { this.questList[this.questIndex].options[0].value this.$toFixed(Number(this.questList[this.questIndex].options[0].value), 2) }, 0)},