index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/classNames'
  3. baseComponent({
  4. relations: {
  5. '../row/index': {
  6. type: 'parent',
  7. },
  8. },
  9. properties: {
  10. prefixCls: {
  11. type: String,
  12. value: 'wux-col',
  13. },
  14. span: {
  15. value: 0,
  16. type: Number,
  17. },
  18. offset: {
  19. value: 0,
  20. type: Number,
  21. },
  22. pull: {
  23. value: 0,
  24. type: Number,
  25. },
  26. push: {
  27. value: 0,
  28. type: Number,
  29. },
  30. },
  31. data: {
  32. colStyle: '',
  33. },
  34. computed: {
  35. classes() {
  36. const { prefixCls, span, offset, pull, push } = this.data
  37. const wrap = classNames(prefixCls, {
  38. [`${prefixCls}--span-${span}`]: span,
  39. [`${prefixCls}--offset-${offset}`]: offset,
  40. [`${prefixCls}--pull-${pull}`]: pull,
  41. [`${prefixCls}--push-${push}`]: push,
  42. })
  43. return {
  44. wrap,
  45. }
  46. },
  47. },
  48. methods: {
  49. updateStyle(colStyle) {
  50. if (this.data.colStyle !== colStyle) {
  51. this.setData({
  52. colStyle,
  53. })
  54. }
  55. },
  56. },
  57. })