popup.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6. };
  7. import { SuperComponent, wxComponent } from '../common/src/index';
  8. import config from '../common/config';
  9. import props from './props';
  10. import transition from '../mixins/transition';
  11. import useCustomNavbar from '../mixins/using-custom-navbar';
  12. delete props.visible;
  13. const { prefix } = config;
  14. const name = `${prefix}-popup`;
  15. let Popup = class Popup extends SuperComponent {
  16. constructor() {
  17. super(...arguments);
  18. this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`];
  19. this.behaviors = [transition(), useCustomNavbar];
  20. this.options = {
  21. multipleSlots: true,
  22. };
  23. this.properties = props;
  24. this.data = {
  25. prefix,
  26. classPrefix: name,
  27. };
  28. this.methods = {
  29. handleOverlayClick() {
  30. const { closeOnOverlayClick } = this.properties;
  31. if (closeOnOverlayClick) {
  32. this.triggerEvent('visible-change', { visible: false, trigger: 'overlay' });
  33. }
  34. },
  35. handleClose() {
  36. this.triggerEvent('visible-change', { visible: false, trigger: 'close-btn' });
  37. },
  38. };
  39. }
  40. };
  41. Popup = __decorate([
  42. wxComponent()
  43. ], Popup);
  44. export default Popup;