index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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-card',
  9. },
  10. bordered: {
  11. type: Boolean,
  12. value: true,
  13. },
  14. full: {
  15. type: Boolean,
  16. value: false,
  17. },
  18. title: {
  19. type: String,
  20. value: '',
  21. },
  22. thumb: {
  23. type: String,
  24. value: '',
  25. },
  26. thumbStyle: {
  27. type: [String, Object],
  28. value: '',
  29. observer(newVal) {
  30. this.setData({
  31. extStyle: styleToCssString(newVal),
  32. })
  33. },
  34. },
  35. extra: {
  36. type: String,
  37. value: '',
  38. },
  39. },
  40. data: {
  41. extStyle: '',
  42. },
  43. computed: {
  44. classes() {
  45. const { prefixCls, bordered, full } = this.data
  46. const wrap = classNames(prefixCls, {
  47. [`${prefixCls}--bordered`]: bordered,
  48. [`${prefixCls}--full`]: full,
  49. })
  50. const hd = `${prefixCls}__hd`
  51. const content = `${prefixCls}__content`
  52. const thumb = `${prefixCls}__thumb`
  53. const extra = `${prefixCls}__extra`
  54. const bd = `${prefixCls}__bd`
  55. const ft = `${prefixCls}__ft`
  56. return {
  57. wrap,
  58. hd,
  59. content,
  60. thumb,
  61. extra,
  62. bd,
  63. ft,
  64. }
  65. },
  66. },
  67. })