img-three.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="img-box">
  3. <view class="img-item" v-for="(fileItem,fileIndex) in fileList">
  4. <image :class="{'image-two':type===2}" :src="fileItem" @click.stop="previewImage(fileIndex)" mode="aspectFill"></image>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: "img-three",
  11. components: {},
  12. props: {
  13. fileList:{
  14. default:[]
  15. },
  16. type:{
  17. default:1
  18. }
  19. },
  20. data() {
  21. return {}
  22. },
  23. watch: {},
  24. mounted() {
  25. },
  26. methods: {
  27. previewImage(index){
  28. uni.previewImage({
  29. urls: this.fileList,
  30. current:index
  31. });
  32. }
  33. }
  34. }
  35. </script>
  36. <style scoped lang="scss">
  37. .img-box{
  38. height: auto;
  39. display: flex;
  40. flex-wrap: wrap;
  41. .img-item{
  42. display: inline-block;
  43. margin-right:12rpx;
  44. image{
  45. width: calc((100vw - 214rpx)/3);
  46. height: calc((100vw - 214rpx)/3);
  47. border-radius: 16rpx;
  48. }
  49. .image-two{
  50. width: calc((100vw - 288rpx)/3);
  51. height: calc((100vw - 288rpx)/3);
  52. }
  53. }
  54. .img-item:nth-of-type(3n+0){
  55. margin-right:0;
  56. }
  57. .img-item:nth-of-type(n+4){
  58. margin-top:10rpx;
  59. }
  60. }
  61. </style>