cell-group.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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-group`;
  12. let CellGroup = class CellGroup extends SuperComponent {
  13. constructor() {
  14. super(...arguments);
  15. this.externalClasses = [`${prefix}-class`, `${prefix}-class-title`];
  16. this.relations = {
  17. '../cell/cell': {
  18. type: 'child',
  19. linked() {
  20. this.updateLastChid();
  21. },
  22. },
  23. };
  24. this.options = {
  25. addGlobalClass: true,
  26. };
  27. this.properties = props;
  28. this.data = {
  29. prefix,
  30. classPrefix: name,
  31. };
  32. this.methods = {
  33. updateLastChid() {
  34. const items = this.$children;
  35. items.forEach((child, index) => child.setData({ isLastChild: index === items.length - 1 }));
  36. },
  37. };
  38. }
  39. };
  40. CellGroup = __decorate([
  41. wxComponent()
  42. ], CellGroup);
  43. export default CellGroup;