Detailed introduction of WeChat applet action-sheet component

高洛峰
Release: 2017-02-20 14:12:09
Original
2058 people have browsed it

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

微信小程序 action-sheet组件详细介绍

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:

微信小程序 action-sheet组件详细介绍

##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>
Copy after login

js

Page({
 data:{
 // text:"这是一个页面"
 actionSheetHidden: true,
 actionSheetItems: [&#39;item1&#39;, &#39;item2&#39;, &#39;item3&#39;]

 },

 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(){
 // 页面关闭
 }
})
Copy after login

More WeChat mini program actions- For detailed introduction to the sheet component, please pay attention to the PHP Chinese website for related articles!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!