Posted in Javascript onMay 11, 2017
微信小程序 action-sheet 反馈上拉菜单简单实例
看下实现效果图:
js
var items = ['item1', 'item2', 'item3', 'item4'] var pageObject = { data: { actionSheetHidden: true, actionSheetItems: items }, actionSheetTap: function (e) { this.setData({ actionSheetHidden: !this.data.actionSheetHidden }) }, actionSheetChange: function (e) { this.setData({ actionSheetHidden: !this.data.actionSheetHidden }) } } for (var i = 0; i < items.length; ++i) { (function (itemName) { pageObject['bind' + itemName] = function (e) { console.log('click' + itemName, e) } })(items[i]) } Page(pageObject)
wxml
<button type="default" bindtap="actionSheetTap">弹出action sheet</button> <action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange"> <block wx:for-items="{{actionSheetItems}}"> <action-sheet-item class="item" bindtap="bind{{item}}">{{item}}</action-sheet-item> </block> <action-sheet-cancel class="cancel">取消</action-sheet-cancel> </action-sheet>
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
微信小程序 action-sheet 反馈上拉菜单简单实例
- Author -
xiaochun365声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@