en-image-video.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <view class="row image-box">
  4. <view class="image-item m-r20 m-t20" mode="aspectFill" v-for="(item,index) in imgList">
  5. <image class="image r-10 " :src="item.url" :style="[{width},{height}]" @click="onPreviewImage(item)">
  6. </image>
  7. <image class="wh-45 video-icon" src="/static/img/task/play.png" mode="aspectFill" v-if="item.type == 2">
  8. </image>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. is_both: {
  17. type: Boolean,
  18. default: false
  19. },
  20. width: {
  21. type: String,
  22. default: '130rpx'
  23. },
  24. height: {
  25. type: String,
  26. default: '130rpx'
  27. },
  28. img: {
  29. default: []
  30. },
  31. previewImage: {
  32. default: []
  33. }
  34. },
  35. data() {
  36. return {
  37. imgList: [{
  38. url: '/static/img/index/top-nav.png',
  39. type: 1
  40. }, {
  41. url: '/static/img/index/top-nav.png',
  42. type: 2
  43. }, {
  44. url: '/static/img/index/top-nav.png',
  45. type: 1
  46. }, {
  47. url: '/static/img/index/top-nav.png',
  48. type: 2
  49. }, {
  50. url: '/static/img/index/top-nav.png',
  51. type: 2
  52. }, ]
  53. }
  54. },
  55. mounted() {},
  56. methods: {
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .image-box {
  62. flex-wrap: wrap;
  63. }
  64. .image-item {
  65. position: relative;
  66. .image {
  67. display: block;
  68. }
  69. .video-icon {
  70. position: absolute;
  71. top: 50%;
  72. left: 50%;
  73. transform: translate(-50%, -50%);
  74. }
  75. }
  76. </style>