Compare commits

...

4 Commits

2 changed files with 48 additions and 2 deletions
+48 -1
View File
@@ -12,6 +12,12 @@
}" }"
@tap.stop="inputClick" @tap.stop="inputClick"
> >
<view
v-if="showLeftIcon"
class="tn-input__left-icon__item tn-input__left-icon__clear"
>
<tn-button shape="icon" :scene="scene" :block-time="blockTime" @click="leftIconClick"><view class="icon" :class="[`tn-icon-${leftIcon}`]"></view></tn-button>
</view>
<textarea <textarea
v-if="type === 'textarea'" v-if="type === 'textarea'"
class="tn-input__input tn-input__textarea" class="tn-input__input tn-input__textarea"
@@ -240,6 +246,16 @@
type: String, type: String,
default: '' default: ''
}, },
// 是否在输入框内最左边显示图标
showLeftIcon: {
type: Boolean,
default: false
},
// 最左边图标的名称
leftIcon: {
type: String,
default: ''
},
//场景:debounce :防抖模式 throttle:节流模式 //场景:debounce :防抖模式 throttle:节流模式
scene:{ scene:{
type: String, type: String,
@@ -309,6 +325,9 @@
this.$on("on-form-item-error", this.onFormItemError) this.$on("on-form-item-error", this.onFormItemError)
}, },
methods: { methods: {
leftIconClick(){
this.$emit('leftClick', this.defaultValue)
},
rightIconClick(){ rightIconClick(){
this.$emit('rightClick', this.defaultValue) this.$emit('rightClick', this.defaultValue)
}, },
@@ -428,7 +447,8 @@
&--error { &--error {
border-color: $tn-color-red !important; border-color: $tn-color-red !important;
} }
&__right-icon { &__right-icon {
line-height: 1; line-height: 1;
.icon { .icon {
@@ -457,5 +477,32 @@
} }
} }
} }
&__left-icon {
line-height: 1;
&__item {
margin-left: 0rpx;
margin-top: 4rpx;
}
&__clear {
.icon {
font-size: 32rpx;
color: $tn-font-sub-color;
}
}
&__select {
transition: transform .4s;
.icon {
font-size: 26rpx;
}
&--reverse {
transform: rotate(-180deg);
}
}
}
} }
</style> </style>
-1
View File
@@ -20,7 +20,6 @@ export function throttleFun(func, delay=500) {
timer = setTimeout(() => { timer = setTimeout(() => {
//执行前清空 //执行前清空
timer = null; timer = null;
console.log("执行了")
func.apply(this, args); func.apply(this, args);
}, delay); }, delay);
} }