actionsheet.js 777 B

12345678910111213141516171819202122232425262728293031323334
  1. Page({
  2. open: function(){
  3. wx.showActionSheet({
  4. itemList: ['A', 'B', 'C'],
  5. success: function(res) {
  6. if (!res.cancel) {
  7. console.log(res.tapIndex)
  8. }
  9. }
  10. });
  11. },
  12. data: {
  13. showDialog: false,
  14. groups: [
  15. { text: '示例菜单', value: 1 },
  16. { text: '示例菜单', value: 2 },
  17. { text: '负向菜单', type: 'warn', value: 3 }
  18. ]
  19. },
  20. openDialog: function () {
  21. this.setData({
  22. showDialog: true
  23. })
  24. },
  25. closeDialog: function () {
  26. this.setData({
  27. showDialog: false
  28. })
  29. },
  30. btnClick(e) {
  31. console.log(e)
  32. this.closeDialog()
  33. }
  34. });