index.js 746 B

12345678910111213141516171819202122232425262728293031323334
  1. const getHeight = require("../../utils/getHeight");
  2. Component({
  3. properties: {
  4. show: {
  5. type: Boolean
  6. },
  7. handle: {
  8. type: Function
  9. }, //按钮回调函数
  10. zIndex: {
  11. type: String,
  12. value: 99999,
  13. },
  14. },
  15. lifetimes: {
  16. ready() {
  17. getHeight.getHeight('.head', this).then(res => this.setData({
  18. listHeight: res - 80
  19. }));
  20. }
  21. },
  22. methods: {
  23. onClick(e) {
  24. const {
  25. name
  26. } = e.target.dataset;
  27. if (name) this.triggerEvent("handle", name)
  28. },
  29. onClose() {
  30. this.triggerEvent("handle", "close")
  31. }
  32. }
  33. })