From a9d5edeecbb2ca05f634df5a8612b652722122ad Mon Sep 17 00:00:00 2001 From: Wen Fangping Date: Wed, 9 Mar 2022 16:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BD=9B=E5=89=8D=E4=BE=9B?= =?UTF-8?q?=E7=81=AFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/random-money/index.vue | 3 +-- src/mixins/index.js | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/random-money/index.vue b/src/components/random-money/index.vue index 94f6829..f565494 100644 --- a/src/components/random-money/index.vue +++ b/src/components/random-money/index.vue @@ -85,8 +85,7 @@ export default { this.inputNickname = res.nickname; }, onMoneyInput(e){ - console.log(e.target.value) - this.number = this.money + this.number = e.target.value }, changeMoney(){ const rand = Math.floor(Math.random() * this.randList.length); diff --git a/src/mixins/index.js b/src/mixins/index.js index 5078a31..0d9d848 100644 --- a/src/mixins/index.js +++ b/src/mixins/index.js @@ -7,7 +7,8 @@ export default { numberOnly: { bind: function(el) { el.handler = function() { - el.value = el.value.replace(/\D+/, '') + // el.value = el.value.replace(/\D+/, '') + el.value = el.value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1') } el.addEventListener('input', el.handler) },