index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/classNames'
  3. import styleToCssString from '../helpers/styleToCssString'
  4. baseComponent({
  5. properties: {
  6. prefixCls: {
  7. type: String,
  8. value: 'wux-whitespace',
  9. },
  10. size: {
  11. type: String,
  12. value: 'default',
  13. },
  14. bodyStyle: {
  15. type: [String, Object],
  16. value: '',
  17. observer(newVal) {
  18. this.setData({
  19. extStyle: styleToCssString(newVal),
  20. })
  21. },
  22. },
  23. },
  24. data: {
  25. extStyle: '',
  26. },
  27. computed: {
  28. classes() {
  29. const { prefixCls, size } = this.data
  30. const wrap = classNames(prefixCls, {
  31. [`${prefixCls}--${size}`]: size,
  32. })
  33. return {
  34. wrap,
  35. }
  36. },
  37. },
  38. methods: {
  39. onTap() {
  40. this.triggerEvent('click')
  41. },
  42. },
  43. })