cell.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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}-cell`;
  12. let Cell = class Cell extends SuperComponent {
  13. constructor() {
  14. super(...arguments);
  15. this.externalClasses = [
  16. `${prefix}-class`,
  17. `${prefix}-class-title`,
  18. `${prefix}-class-description`,
  19. `${prefix}-class-note`,
  20. `${prefix}-class-hover`,
  21. `${prefix}-class-image`,
  22. `${prefix}-class-left`,
  23. `${prefix}-class-left-icon`,
  24. `${prefix}-class-right`,
  25. `${prefix}-class-right-icon`,
  26. ];
  27. this.options = {
  28. multipleSlots: true,
  29. };
  30. this.properties = props;
  31. this.data = {
  32. prefix,
  33. classPrefix: name,
  34. };
  35. }
  36. onClick(e) {
  37. this.triggerEvent('click', e.detail);
  38. this.jumpLink();
  39. }
  40. jumpLink(urlKey = 'url', link = 'jumpType') {
  41. const url = this.data[urlKey];
  42. const jumpType = this.data[link];
  43. if (url) {
  44. wx[jumpType]({ url });
  45. }
  46. }
  47. };
  48. Cell = __decorate([
  49. wxComponent()
  50. ], Cell);
  51. export default Cell;