zoukankan      html  css  js  c++  java
  • 微信小程序组件action-sheet

    操作反馈action-sheet:官方文档

    Demo Code:

    Page({
      data: {
        actionSheetHidden: true,
        actionSheetItems: ['item1', 'item2', 'item3', 'item4']
      },
      actionSheetTap: function(e) {
        this.setData({
          actionSheetHidden: !this.data.actionSheetHidden
        });
      },
      actionSheetChange:function(e){
        this.setData({
          actionSheetHidden: !this.data.actionSheetHidden
        });
      },
      bindItemTap:function(e){
        console.log('tap ' + e.currentTarget.dataset.name);
      }
    })
    JS
    <button type="default" bindtap="actionSheetTap">弹出action sheet</button>
    <action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange">
        <block wx:for="{{actionSheetItems}}">
            <action-sheet-item class="item" bindtap="bindItemTap" data-name="{{item}}">{{item}}</action-sheet-item>
        </block>
        <action-sheet-cancel class="cancel">取消</action-sheet-cancel>
    </action-sheet>
    WXML

    Tip:

    开发工具选择的手机型号不同,有的会看不到 取消 选项

  • 相关阅读:
    Fibonacci Numbers
    Fibonacci(...刷的前几道题没有记博客的习惯,吃了大亏)
    Fibonacci Check-up
    Pendant
    奥运
    Tr A
    A Simple Game
    Be the Winner
    John
    Being a Good Boy in Spring Festival(尼姆博弈)
  • 原文地址:https://www.cnblogs.com/betterlife/p/5970193.html
Copyright © 2011-2022 走看看