index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/libs/classNames'
  3. import styleToCssString from '../helpers/libs/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: ['prefixCls, align', function(prefixCls, align) {
  41. const wrap = classNames(prefixCls, {
  42. [`${prefixCls}--align-${align}`]: align,
  43. })
  44. const hd = `${prefixCls}__hd`
  45. const thumb = `${prefixCls}__thumb`
  46. const bd = `${prefixCls}__bd`
  47. const title = `${prefixCls}__title`
  48. const desc = `${prefixCls}__desc`
  49. return {
  50. wrap,
  51. hd,
  52. thumb,
  53. bd,
  54. title,
  55. desc,
  56. }
  57. }],
  58. },
  59. })