actionsheet add opentype (#106)

This commit is contained in:
Yao 2018-01-09 15:09:36 +08:00 committed by GitHub
parent 7fc4176003
commit ef1028837d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -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
});

View File

@ -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