From a8ff66137ee5397527290dd015d9d9ea39065cf4 Mon Sep 17 00:00:00 2001 From: whycq <you@example.com> Date: 星期五, 23 九月 2022 01:00:34 +0800 Subject: [PATCH] # --- components/y-input/y-input.vue | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/components/y-input/y-input.vue b/components/y-input/y-input.vue index f7d2a9f..7473874 100644 --- a/components/y-input/y-input.vue +++ b/components/y-input/y-input.vue @@ -3,7 +3,8 @@ <view class="main"> <view class="title item-height">{{titleText}}</view> <view class="input item-height"> - <input type="text" :placeholder="placeholderText" placeholder-style="font-size:28rpx" v-model="val"> + <input type="text" :placeholder="placeholderText" @input="input" + placeholder-style="font-size:28rpx" v-model="val"> </view> </view> </view> @@ -17,10 +18,22 @@ type: String, default: '' }, - inputVal: { + value: { + type: [String, Number], + default: '' + }, + placeholder: { type: String, default: '' } + }, + watch: { + value(val) { + this.val = val + }, + }, + created() { + this.val = this.value }, computed: { titleText() { @@ -37,6 +50,11 @@ return { val:'' }; + }, + methods: { + input() { + this.$emit('input',this.val); + } } } </script> @@ -59,18 +77,22 @@ color: #303133; } .input { - font-size: 28rpx; + font-size: 12rpx; color: #606266; } .input input{ width: 96%; + height: 45rpx; + line-height: 50rpx; margin-left: 2%; margin-right: 1%; border-radius: 5rpx; border: 1px solid #EBEDF0; background-color: #FAFAFA; - /* box-shadow: 0 0 10upx rgba(0, 0, 0, 0.2); */ + font-size: 28rpx; + text-indent: 10rpx; + /* letter-spacing: 1rpx; */ } .item-height { height: 50rpx; -- Gitblit v1.9.1