overlay.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. const { prefix } = config;
  13. const name = `${prefix}-overlay`;
  14. let Overlay = class Overlay extends SuperComponent {
  15. constructor() {
  16. super(...arguments);
  17. this.properties = props;
  18. this.behaviors = [transition(), useCustomNavbar];
  19. this.data = {
  20. prefix,
  21. classPrefix: name,
  22. computedStyle: '',
  23. _zIndex: 11000,
  24. };
  25. this.observers = {
  26. backgroundColor(v) {
  27. this.setData({
  28. computedStyle: v ? `background-color: ${v};` : '',
  29. });
  30. },
  31. zIndex(v) {
  32. if (v !== 0) {
  33. this.setData({
  34. _zIndex: v,
  35. });
  36. }
  37. },
  38. };
  39. this.methods = {
  40. handleClick() {
  41. this.triggerEvent('click', { visible: !this.properties.visible });
  42. },
  43. noop() { },
  44. };
  45. }
  46. };
  47. Overlay = __decorate([
  48. wxComponent()
  49. ], Overlay);
  50. export default Overlay;