divider.js 1.6 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. const { prefix } = config;
  11. const name = `${prefix}-divider`;
  12. let Divider = class Divider extends SuperComponent {
  13. constructor() {
  14. super(...arguments);
  15. this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`];
  16. this.options = {
  17. addGlobalClass: true,
  18. multipleSlots: true,
  19. };
  20. this.properties = props;
  21. this.data = {
  22. prefix,
  23. classPrefix: name,
  24. };
  25. this.observers = {
  26. lineColor() {
  27. this.setStyle();
  28. },
  29. };
  30. this.methods = {
  31. setStyle() {
  32. const { lineColor } = this.properties;
  33. const dividerStyle = `${lineColor ? `border-color: ${lineColor};` : ''}`;
  34. this.setData({
  35. dividerStyle,
  36. });
  37. },
  38. };
  39. }
  40. };
  41. Divider = __decorate([
  42. wxComponent()
  43. ], Divider);
  44. export default Divider;