index.vue 2.1 KB

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