InfoGoodsSwipe.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <!-- GoodsSwipe.vue -->
  2. <template>
  3. <view class="div swipe-wrapper ui-common-swiper" v-bind:style="'width:'+getBannerStyle.width+'px;height:'+getBannerStyle.height+'px'" v-if="detailInfo">
  4. <image mode="aspectFit" class="img" v-if="detailInfo.pgoods_image" v-bind:src="detailInfo.pgoods_image" @click="setPopupVisible()" />
  5. </view>
  6. </template>
  7. <script>
  8. import PreviewPicture from './PreviewPicture'
  9. import { mapState, mapMutations } from 'vuex'
  10. export default {
  11. data () {
  12. return {
  13. popupVisible: false
  14. }
  15. },
  16. components: {
  17. 'v-picture': PreviewPicture
  18. },
  19. created () {
  20. uni.$on('hide-priview-picture', value => {
  21. this.popupVisible = value
  22. this.setisPreviewPicture(value)
  23. })
  24. },
  25. computed: {
  26. ...mapState({
  27. detailInfo: state => state.pointsgoods.detailInfo
  28. }),
  29. getBannerStyle: function () {
  30. const res = uni.getSystemInfoSync()
  31. var width = res.windowWidth
  32. var height = res.windowHeight
  33. let itemWidth = width
  34. let itemHeight = width
  35. return {
  36. width: itemWidth,
  37. height: itemHeight
  38. }
  39. }
  40. },
  41. beforeDestroy: function () {
  42. uni.$off('hide-priview-picture')
  43. },
  44. methods: {
  45. ...mapMutations({
  46. setisPreviewPicture: 'setisPreviewPicture'
  47. }),
  48. setPopupVisible () {
  49. this.popupVisible = true
  50. this.setisPreviewPicture(true)
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss">
  56. .ui-common-swiper {
  57. width: 100%;
  58. height: 100%;
  59. text-align:center;
  60. .img {
  61. height: 100%;
  62. width: 100%;
  63. }
  64. }
  65. </style>