index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div>
  3. <van-image :width="width" :height="height" :src="src" @click="onClickShow" />
  4. <van-image-preview v-model="show" :images="listImg" @change="onChange">
  5. <template v-slot:index>第{{ index }}页</template>
  6. </van-image-preview>
  7. <!-- <van-overlay :show="show" @click="onClickHide">
  8. <div class="imgsty">
  9. <van-image :src="src" />
  10. </div>
  11. </van-overlay> -->
  12. </div>
  13. <!-- <van-overlay :show="false">
  14. <view class="wrapper">
  15. <van-image :width="width" :height="height" :src="src" />
  16. </view>
  17. </van-overlay> -->
  18. </template>
  19. <script>
  20. export default {
  21. props: {
  22. width: {
  23. type: String,
  24. default: '100'
  25. },
  26. height: {
  27. type: String,
  28. default: '100'
  29. },
  30. src: {
  31. type: String,
  32. default: 'https://img.yzcdn.cn/vant/cat.jpeg'
  33. },
  34. imgList: {
  35. type: Array,
  36. default: () => {
  37. return []
  38. }
  39. }
  40. },
  41. name: 'SocAppIndex',
  42. data() {
  43. return {
  44. this_:this,
  45. show: false,
  46. this_window:window,
  47. index:'',
  48. }
  49. },
  50. computed:{
  51. listImg(){
  52. this.imgList.filter(item=>{
  53. if(item.url&&item.type==0){
  54. return item.url
  55. }
  56. })
  57. }
  58. },
  59. mounted() {},
  60. methods: {
  61. onClickShow() {
  62. this.show = true
  63. },
  64. onClickHide() {
  65. this.show = false
  66. },
  67. onChange(index) {
  68. this.index = index;
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .imgsty {
  75. position: absolute;
  76. top: 28%;
  77. }
  78. </style>