From d170cf41d68bbb82179fae1b2332a315465ef93b Mon Sep 17 00:00:00 2001 From: whycq <you@example.com> Date: 星期五, 23 九月 2022 00:49:50 +0800 Subject: [PATCH] # --- components/y-input/y-input.vue | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/y-input/y-input.vue b/components/y-input/y-input.vue index 509986e..2581287 100644 --- a/components/y-input/y-input.vue +++ b/components/y-input/y-input.vue @@ -3,7 +3,7 @@ <view class="main"> <view class="title item-height">{{titleText}}</view> <view class="input item-height"> - <input type="text" :placeholder="placeholderText" @input="input(val)" + <input type="text" :placeholder="placeholderText" @input="input" placeholder-style="font-size:28rpx" v-model="val"> </view> </view> @@ -22,6 +22,11 @@ type: [String, Number], default: '' } + }, + watch: { + value(val) { + this.val = val + }, }, created() { this.val = this.value @@ -43,9 +48,8 @@ }; }, methods: { - input(val) { - this.val = val - this.$emit('input',val); + input() { + this.$emit('input',this.val); } } } -- Gitblit v1.9.1