index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <!-- 自定义组件 -->
  3. <view class='wrapper card' v-if="customForm && customForm.length && isShow">
  4. <view class='item acea-row row-between' v-for="(item,index) in customForm" :key="index" v-if="item.value">
  5. <view>{{item.title}}:</view>
  6. <view v-if="item.label == 'img'" class='conter'>
  7. <view class='pictrue' v-for="(img,indexn) in item.value" :key="indexn">
  8. <image :src='img' mode="aspectFill" @click='getCustomForm(index,indexn)'></image>
  9. </view>
  10. </view>
  11. <view v-if="item.label != 'img'" class='conter'>{{item.value}}</view>
  12. </view>
  13. <slot name="bottom"></slot>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'customForm',
  19. props: {
  20. customForm:{
  21. type: Array,
  22. default: () => []
  23. }
  24. },
  25. data() {
  26. return {
  27. isShow:0
  28. };
  29. },
  30. watch: {
  31. customForm (value) {
  32. if(value && value.length){
  33. value.forEach((item)=>{
  34. if(item.value){
  35. return this.isShow = 1
  36. }
  37. })
  38. }
  39. }
  40. },
  41. created() {},
  42. mounted() {},
  43. methods: {
  44. getCustomForm: function(index,indexn) {
  45. uni.previewImage({
  46. urls: this.customForm[index].value,
  47. current: this.customForm[index].value[indexn]
  48. });
  49. },
  50. }
  51. };
  52. </script>
  53. <style lang="scss">
  54. .wrapper{
  55. background-color: #fff;
  56. margin-top: 6px;
  57. padding: 15px;
  58. }
  59. .wrapper .item {
  60. font-size: 28rpx;
  61. color: #282828;
  62. }
  63. .wrapper .item~.item {
  64. margin-top: 20rpx;
  65. white-space: normal;
  66. word-break: break-all;
  67. word-wrap: break-word;
  68. }
  69. .wrapper .item .conter {
  70. color: #868686;
  71. width: 460rpx;
  72. display: flex;
  73. flex-wrap: nowrap;
  74. justify-content: flex-end;
  75. text-align: right;
  76. .pictrue{
  77. width: 80rpx;
  78. height: 80rpx;
  79. margin-left: 6rpx;
  80. image{
  81. width: 100%;
  82. height: 100%;
  83. border-radius: 6rpx;
  84. }
  85. }
  86. }
  87. </style>