uniappのinputコンポーネントは、ユーザーが@inputイベントに入力できる値の範囲を制限しており、ビューが更新されないバグが発生します。

入力イベントがユーザーによって入力された値を取得し、入力コンポーネントにバインドされた値を割り当てる前に、ユーザーの入力が最大値を超えることはできないと判断されます。超えた場合、デフォルトは 100 です。この判断と割り当て、およびビューの更新は 1 回だけトリガーされます。入力後、値がページを変更しましたが更新されていないことがわかります。ワイプして、v-modelと:valueの両方を試しました。それは役に立たない、インターネット上で説明されているバグは 19 年前まで遡ることができます。古いバグのようです。解決策は、ディレイラーに割り当てコードを記述することです。

$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)
			},

おすすめ

転載: blog.csdn.net/m0_57033755/article/details/131855889