en-image.vue 757 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <view>
  3. <view class="row">
  4. <image class="image-item r-10 m-r20 m-b20" :style="[{width},{height}]" :src="item" mode="aspectFill"
  5. v-for="(item,index) in list" @click="onPreviewImage(index)"></image>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. is_both: {
  13. type: Boolean,
  14. default: false
  15. },
  16. width: {
  17. type: String,
  18. default: '160rpx'
  19. },
  20. height: {
  21. type: String,
  22. default: '90rpx'
  23. },
  24. list: {
  25. type: Array,
  26. default: () => []
  27. }
  28. },
  29. data() {
  30. return {}
  31. },
  32. methods: {
  33. onPreviewImage(index) {
  34. uni.previewImage({
  35. urls: this.list,
  36. current: index
  37. });
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .image-item {
  44. display: block;
  45. }
  46. </style>