您的位置:首页 > 移动开发 > Android开发

实现底部的弹出框(官方API实现Android的在屏幕中间)

2017-09-22 20:23 351 查看

布局

<button bindtap='actionSheetTap'>Sheet</button>
<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange">
<block wx:for-items="{{actionSheetItems}}" wx:key="{{actionSheetItems}}">
<action-sheet-item class="item" bindtap="bindItemTap" data-index="{{index}}" data-name="{{item}}">{{item}}</action-sheet-item>
</block>
<action-sheet-cancel class="cancel">取消</action-sheet-cancel>
</action-sheet>


js

Page({
data: {
actionSheetHidden: true,
actionSheetItems: ["1", "2"]
},

/**
* 点击弹出窗口
*/
actionSheetTap: function () {
this.setData({
actionSheetHidden: !this.data.actionSheetHidden
});
},

actionSheetChange: function (e) {
this.setData({
actionSheetHidden: !this.data.actionSheetHidden
});
},

bindItemTap: function (e) {
console.log(e.currentTarget.dataset.index);
if (e.currentTarget.dataset.index==0){
wx.scanCode({
success: (res) =>{
console.log(res.result);

}
})
}
},
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  小程序底部弹窗