wxapp operation feedback pull-up menu action-sheet
action-sheet
Pull-up menu, a menu sheet that appears from the bottom of the screen.
action-sheet-item
Sub-options of the bottom menu sheet.
action-sheet-cancel
The difference between the cancel button of the bottom menu sheet and action-sheet-item is that clicking it will trigger the change event of action-sheet, and the appearance will be spaced apart from the content above it.
Sample code:
<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>
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)
##