index.js 686 B

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