mirror of
https://gitee.com/TSpecific/tuniao-ui.git
synced 2026-06-06 19:44:38 +08:00
[add] input 左边图标,新增2个prop:leftIcon 左边图标、showLeftIcon是否显示左边图标,新增一个事件,leftClick:点击左边的触发
This commit is contained in:
@@ -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)
|
||||||
},
|
},
|
||||||
@@ -429,6 +448,7 @@
|
|||||||
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>
|
||||||
|
|||||||
Reference in New Issue
Block a user