From bb80bb875fb93cc84415d7536849fe4536af5c20 Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期二, 13 十二月 2022 11:03:22 +0800 Subject: [PATCH] # --- components/y-input/y-input.vue | 44 ++++++++++++++++++++++++++++++++------------ 1 files changed, 32 insertions(+), 12 deletions(-) diff --git a/components/y-input/y-input.vue b/components/y-input/y-input.vue index 6b7919f..ccfe5c5 100644 --- a/components/y-input/y-input.vue +++ b/components/y-input/y-input.vue @@ -1,13 +1,15 @@ <template> <view> <view class="main"> - <view style="display: flex;align-items: center;"> - <y-title :title="titleText"/> - </view> + <y-title :title="titleText"/> <view :class="zBig"> - <input type="text" :placeholder="placeholderText" @input="input" - placeholder-style="font-size:22rpx" v-model="val"> - <slot /> + <view style="display: flex;" class="input"> + <input type="text" :placeholder="placeholderText" @input="input" + placeholder-style="font-size:22rpx" v-model="val"> + <view class="icons" v-if="val.length" @click="clear"> + <uni-icons type="close"></uni-icons> + </view> + </view> </view> </view> </view> @@ -45,9 +47,6 @@ placeholderText() { return this.placeholder }, - // val() { - // return this.inputVal || t("uni-popup.inputVal") - // } }, data() { return { @@ -68,7 +67,12 @@ methods: { input() { this.$emit('input',this.val); + }, + clear() { + this.val = '' + this.input() } + } } </script> @@ -82,10 +86,9 @@ border-radius: 5rpx; box-shadow: 0 0 10upx rgba(0, 0, 0, 0.1); } - input{ + .input{ width: 96%; - height: 45rpx; - line-height: 50rpx; + height: 100%; margin-left: 2%; margin-right: 1%; border-radius: 5rpx; @@ -96,6 +99,23 @@ text-indent: 8rpx; /* letter-spacing: 1rpx; */ } + input{ + width: 96%; + height: 45rpx; + line-height: 50rpx; + margin-left: 2%; + margin-right: 1%; + border-radius: 5rpx; + color: #606266; + /* border: 1px solid #EBEDF0; */ + /* background-color: #FAFAFA; */ + font-size: 28rpx; + text-indent: 8rpx; + /* letter-spacing: 1rpx; */ + } + .icons { + margin-right: 2% ; + } .big { height: 80rpx; line-height: 80rpx; -- Gitblit v1.9.1