W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
上拉菜單,從屏幕底部出現(xiàn)的菜單表。
屬性名 | 類型 | 默認值 | 說明 |
---|---|---|---|
hidden | Boolean | true | 是否隱藏 |
bindchange | EventHandle | 點擊背景或action-sheet-cancel按鈕時觸發(fā)change事件,不攜帶數(shù)據(jù) |
底部菜單表的子選項。
底部菜單表的取消按鈕,和action-sheet-item的區(qū)別是,點擊它會觸發(fā)action-sheet的change事件,并且外觀上會同它上面的內(nèi)容間隔開來。
示例代碼:
<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)
另可參見 API wx.showActionSheet
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: