微信小程序api视频课程-界面-交互-wx.showActionSheet操作菜单的使用

效果图
微信小程序api视频课程-界面-交互-wx.showActionSheet操作菜单的使用

wxml代码

wx.showActionSheet(Object object) 显示操作菜单

<button bindtap="cd01">操作菜单01</button>

<button bindtap="cd02">操作菜单02</button>

js代码

  /**
   * 页面的初始数据
   */
  data: {
    chengshi:["浙江","江苏","上海"]
  },
  cd01:function(){
    wx.showActionSheet({
      itemList: ["A", "B", "C", "D", "E", "F"],//数组长度最大为6
    })
  },
  cd02: function () {
    var tmp = this.data.chengshi
    wx.showActionSheet({
      itemList: this.data.chengshi,
      success(res){
        console.log(res.tapIndex)
        console.log(tmp[res.tapIndex])
      },
      fail(res){
        console.log(res.errMsg)
      }
    })
  },

欢迎大家收看我的****:微信小程序常用API使用
微信小程序api视频课程-界面-交互-wx.showActionSheet操作菜单的使用