index.js 742 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Component({
  2. properties: {
  3. list: Array,
  4. callback: Function
  5. },
  6. lifetimes: {
  7. attached: function () {
  8. wx.getSystemInfo({
  9. success: res => {
  10. this.setData({
  11. safeAreaBot: res.screenHeight - res.safeArea.bottom
  12. })
  13. }
  14. })
  15. },
  16. },
  17. options: {
  18. addGlobalClass: true
  19. },
  20. data: {
  21. safeAreaBot: 0,
  22. show: false
  23. },
  24. methods: {
  25. onClose() {
  26. this.setData({
  27. show: false
  28. })
  29. },
  30. callback(e) {
  31. console.log(e)
  32. const {
  33. item
  34. } = e.currentTarget.dataset;
  35. if (!item) return;
  36. this.triggerEvent("callback", item)
  37. },
  38. /* open(){
  39. this.setData({
  40. show: true
  41. })
  42. } */
  43. }
  44. })