index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/classNames'
  3. baseComponent({
  4. properties: {
  5. prefixCls: {
  6. type: String,
  7. value: 'wux-divider',
  8. },
  9. position: {
  10. type: String,
  11. value: 'center',
  12. },
  13. dashed: {
  14. type: Boolean,
  15. value: false,
  16. },
  17. text: {
  18. type: String,
  19. value: '',
  20. },
  21. showText: {
  22. type: Boolean,
  23. value: true,
  24. },
  25. },
  26. computed: {
  27. classes() {
  28. const { prefixCls, dashed, showText, position } = this.data
  29. const wrap = classNames(prefixCls, {
  30. [`${prefixCls}--dashed`]: dashed,
  31. [`${prefixCls}--text`]: showText,
  32. [`${prefixCls}--text-${position}`]: showText && position,
  33. })
  34. const text = `${prefixCls}__text`
  35. return {
  36. wrap,
  37. text,
  38. }
  39. },
  40. },
  41. })