mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-22 06:31:46 +08:00
[Improvement] Icon: add tap event
This commit is contained in:
parent
f17a09419f
commit
ef279ded3a
@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
| 事件名 | 说明 | 参数 |
|
| 事件名 | 说明 | 参数 |
|
||||||
|-----------|-----------|-----------|
|
|-----------|-----------|-----------|
|
||||||
| click | 点击按钮且按钮状态不为加载或禁用时触发 | - |
|
| tap | 点击按钮且按钮状态不为加载或禁用时触发 | - |
|
||||||
| getuserinfo | 用户点击该按钮时,会返回获取到的用户信息,从返回参数的 detail 中获取到的值同 wx.getUserInfo | - |
|
| getuserinfo | 用户点击该按钮时,会返回获取到的用户信息,从返回参数的 detail 中获取到的值同 wx.getUserInfo | - |
|
||||||
| contact | 客服消息回调 | - |
|
| contact | 客服消息回调 | - |
|
||||||
| getphonenumber | 获取用户手机号回调 | - |
|
| getphonenumber | 获取用户手机号回调 | - |
|
||||||
|
@ -53,7 +53,7 @@ Component({
|
|||||||
methods: {
|
methods: {
|
||||||
onTap(event) {
|
onTap(event) {
|
||||||
if (!this.data.disabled && !this.data.loading) {
|
if (!this.data.disabled && !this.data.loading) {
|
||||||
this.triggerEvent('click', event);
|
this.triggerEvent('tap', event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
| 事件名 | 说明 | 参数 |
|
| 事件名 | 说明 | 参数 |
|
||||||
|-----------|-----------|-----------|
|
|-----------|-----------|-----------|
|
||||||
| click | 点击图标时触发 | - |
|
| tap | 点击图标时触发 | - |
|
||||||
|
|
||||||
### 外部样式类
|
### 外部样式类
|
||||||
|
|
||||||
|
@ -6,5 +6,11 @@ Component({
|
|||||||
name: String,
|
name: String,
|
||||||
size: String,
|
size: String,
|
||||||
color: String
|
color: String
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onTap(event) {
|
||||||
|
this.triggerEvent('tap', event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<view
|
<view
|
||||||
class="custom-class van-icon van-icon-{{ name }}"
|
class="custom-class van-icon van-icon-{{ name }}"
|
||||||
style="{{ color ? 'color: ' + color : '' }}; {{ size ? 'font-size: ' + size : '' }}"
|
style="{{ color ? 'color: ' + color : '' }}; {{ size ? 'font-size: ' + size : '' }}"
|
||||||
|
bind:tap="onTap"
|
||||||
>
|
>
|
||||||
<view wx:if="{{ info !== null }}" class="van-icon__info">{{ info }}</view>
|
<view wx:if="{{ info !== null }}" class="van-icon__info">{{ info }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user