index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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-media',
  9. },
  10. thumb: {
  11. type: String,
  12. value: '',
  13. },
  14. thumbStyle: {
  15. type: [String, Object],
  16. value: '',
  17. observer(newVal) {
  18. this.setData({
  19. extStyle: styleToCssString(newVal),
  20. })
  21. },
  22. },
  23. title: {
  24. type: String,
  25. value: '',
  26. },
  27. label: {
  28. type: String,
  29. value: '',
  30. },
  31. align: {
  32. type: String,
  33. value: 'center',
  34. },
  35. },
  36. data: {
  37. extStyle: '',
  38. },
  39. computed: {
  40. classes() {
  41. const { prefixCls, align } = this.data
  42. const wrap = classNames(prefixCls, {
  43. [`${prefixCls}--align-${align}`]: align,
  44. })
  45. const hd = `${prefixCls}__hd`
  46. const thumb = `${prefixCls}__thumb`
  47. const bd = `${prefixCls}__bd`
  48. const title = `${prefixCls}__title`
  49. const desc = `${prefixCls}__desc`
  50. return {
  51. wrap,
  52. hd,
  53. thumb,
  54. bd,
  55. title,
  56. desc,
  57. }
  58. },
  59. },
  60. })