path-live.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="activity">
  3. <image :src="banner" mode="widthFix" @click="previewImg()"></image>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. banner:'',
  11. productImage:[]
  12. }
  13. },
  14. onLoad() {
  15. this.GetHomeLiveAdvertising()
  16. },
  17. methods:{
  18. GetHomeLiveAdvertising(){
  19. this.CommonService.GetHomeLiveAdvertising().then(response =>{
  20. this.banner = response.data.liveImage
  21. this.productImage.push(this.banner)
  22. }).catch(error =>{
  23. this.$util.msg(error.msg,3000)
  24. })
  25. },
  26. previewImg (index) {//顶部商品图片预览
  27. let previewUrls = this.productImage
  28. uni.previewImage({
  29. current: 0, //图片索引
  30. urls: previewUrls, //必须是http图片,本地图片无效
  31. longPressActions:''
  32. })
  33. }
  34. },
  35. onPullDownRefresh() {
  36. setTimeout(() => {
  37. this.GetHomeLiveAdvertising()
  38. uni.stopPullDownRefresh()
  39. }, 200)
  40. },
  41. onShow() {
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. .activity{
  47. width: 100%;
  48. height: auto;
  49. image{
  50. width: 100%;
  51. height: auto;
  52. }
  53. }
  54. </style>