微信小程序 action-sheet 反馈上拉菜单

微信小程序 action-sheet 反馈上拉菜单_第1张图片

//js

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)

//wxml




你可能感兴趣的:(微信小程序)