drawer.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. const { prefix } = config;
  11. const name = `${prefix}-drawer`;
  12. let Drawer = class Drawer extends SuperComponent {
  13. constructor() {
  14. super(...arguments);
  15. this.externalClasses = [];
  16. this.options = {
  17. multipleSlots: true,
  18. };
  19. this.properties = props;
  20. this.data = {
  21. classPrefix: name,
  22. };
  23. this.methods = {
  24. visibleChange({ detail }) {
  25. const { visible } = detail;
  26. const { showOverlay } = this.data;
  27. this.setData({
  28. visible: visible,
  29. });
  30. if (showOverlay) {
  31. this.triggerEvent('overlay-click', { visible: visible });
  32. }
  33. },
  34. itemClick(detail) {
  35. const { index, item } = detail.currentTarget.dataset;
  36. this.triggerEvent('item-click', {
  37. sibarItem: { index: index, item: item },
  38. });
  39. },
  40. };
  41. }
  42. };
  43. Drawer = __decorate([
  44. wxComponent()
  45. ], Drawer);
  46. export default Drawer;