mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-25 16:09:15 +08:00
actionsheet add opentype (#106)
This commit is contained in:
parent
7fc4176003
commit
ef1028837d
@ -17,10 +17,20 @@ Page(extend({}, Actionsheet, {
|
||||
subname: '选项描述语2',
|
||||
className: 'action-class',
|
||||
loading: false
|
||||
}, {
|
||||
name: '去分享',
|
||||
openType: 'share'
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: 'ZanUI-WeApp',
|
||||
imageUrl: 'https://img.yzcdn.cn/public_files/2017/02/06/ee0ebced79a80457d77ce71c7d414c74.png'
|
||||
};
|
||||
},
|
||||
|
||||
toggleActionsheet() {
|
||||
this.setData({
|
||||
'baseActionsheet.show': true
|
||||
@ -36,6 +46,11 @@ Page(extend({}, Actionsheet, {
|
||||
handleZanActionsheetClick({ componentId, index }) {
|
||||
console.log(`item index ${index} clicked`);
|
||||
|
||||
// 如果是分享按钮被点击, 不处理关闭
|
||||
if (index === 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setData({
|
||||
[`${componentId}.actions[${index}].loading`]: true
|
||||
});
|
||||
|
@ -7,7 +7,7 @@
|
||||
data-component-id="{{ componentId }}"></view>
|
||||
<view class="zan-actionsheet__container">
|
||||
<!-- 实际按钮显示 -->
|
||||
<view
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:for-index="index"
|
||||
wx:for-item="item"
|
||||
@ -15,13 +15,14 @@
|
||||
catchtap="_handleZanActionsheetBtnClick"
|
||||
data-component-id="{{ componentId }}"
|
||||
data-index="{{ index }}"
|
||||
open-type="{{ item.openType }}"
|
||||
class="zan-btn zan-actionsheet__btn {{ item.loading ? 'zan-btn--loading' : '' }} {{ item.className }}"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
<text
|
||||
wx:if="{{ item.subname }}"
|
||||
class="zan-actionsheet__subname">{{ item.subname }}</text>
|
||||
</view>
|
||||
</button>
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<view
|
||||
|
Loading…
x
Reference in New Issue
Block a user