Home > Article > WeChat Applet > Detailed introduction of WeChat applet action-sheet component
This article mainly introduces the relevant information about the detailed introduction of the action-sheet component of the WeChat applet. Friends in need can refer to it
The action-sheet component is from the bottom The optional menu items pop up, which is probably added based on the design of IOS. action-sheet has two sub-components, action-sheet-item is for each option, action-sheet-cancel cancels the option, and there is a interval, and clicking will trigger the action-sheet listening event
Main attributes:
##wxml
<!--触发action-sheet事件--> <button type="primary" bindtap="listenerButton">弹出ActionSheet</button> <!--默认action-sheet为隐藏,由button触发--> <action-sheet hidden="{{actionSheetHidden}}" bindchange="listenerActionSheet" > <block wx:for-items="{{actionSheetItems}}" > <action-sheet-item >{{item}}</action-sheet-item> </block> <!--自动隐藏action-sheet--> <action-sheet-cancel>取消</action-sheet-cancel> </action-sheet>
js
Page({ data:{ // text:"这是一个页面" actionSheetHidden: true, actionSheetItems: ['item1', 'item2', 'item3'] }, listenerButton: function() { this.setData({ //取反 actionSheetHidden: !this.data.actionSheetHidden }); }, listenerActionSheet:function() { this.setData({ actionSheetHidden: !this.data.actionSheetHidden }) }, onLoad:function(options){ // 页面初始化 options为页面跳转所带来的参数 }, onReady:function(){ // 页面渲染完成 }, onShow:function(){ // 页面显示 }, onHide:function(){ // 页面隐藏 }, onUnload:function(){ // 页面关闭 } })More WeChat mini program actions- For detailed introduction to the sheet component, please pay attention to the PHP Chinese website for related articles!