CellInfo.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="list-cell">
  3. <view class="label" :style="{ 'max-width': width + 'rpx' }" v-text="label">
  4. </view>
  5. <view
  6. class="value"
  7. :class="valueClass"
  8. v-text="value"
  9. v-if="typeof value !== 'object'"
  10. >
  11. </view>
  12. <view v-if="typeof value === 'object'" class="value">
  13. <view
  14. class=""
  15. v-for="(item, index) in value"
  16. :key="index"
  17. @click="preview(item)"
  18. >
  19. {{ item.name }}
  20. </view>
  21. </view>
  22. <view v-if="icon" :class="icon"> </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'CellInfo',
  28. props: {
  29. width: {
  30. type: [String, Number],
  31. default: '200'
  32. },
  33. label: {
  34. type: [String, Number],
  35. default: ''
  36. },
  37. value: {
  38. type: [String, Number, Array],
  39. default: ''
  40. },
  41. valueClass: {
  42. type: String,
  43. default: ''
  44. },
  45. icon: {
  46. type: [String, Array],
  47. default: ''
  48. }
  49. },
  50. data () {
  51. return {}
  52. },
  53. methods: {
  54. preview (res) {
  55. uni.previewImage({
  56. urls: [this.apiUrl + res.accessUrl]
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .list-cell {
  64. display: flex;
  65. align-items: self-start;
  66. justify-content: space-between;
  67. padding: 20rpx 0;
  68. color: $uni-text-color;
  69. border-bottom: 2rpx solid #d8d8d8;
  70. font-size: 28rpx;
  71. view {
  72. flex: 1;
  73. padding: 0 30rpx;
  74. }
  75. .label {
  76. color: $uni-text-color-grey;
  77. text-align: right;
  78. }
  79. .value {
  80. flex: 1;
  81. text-align: left;
  82. word-break: break-all;
  83. }
  84. .iconfont {
  85. text-align: right;
  86. }
  87. }
  88. </style>