page-image.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. webviewStyles: {
  11. progress: {
  12. color: '#FF3333'
  13. }
  14. },
  15. banner:'',
  16. productImage:[],
  17. }
  18. },
  19. onLoad(option) {
  20. this.banner = option.image
  21. this.productImage.push(option.image)
  22. uni.setNavigationBarTitle({title:option.title});
  23. },
  24. methods:{
  25. navToDetailPage() {//跳转商品详情页
  26. this.$api.navigateTo(`/pages/goods/product?id=${this.productID}`)
  27. },
  28. previewImg (index) {//顶部商品图片预览
  29. let previewUrls = this.productImage
  30. uni.previewImage({
  31. current: 0, //图片索引
  32. urls: previewUrls, //必须是http图片,本地图片无效
  33. longPressActions:''
  34. })
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. .activity{
  41. width: 100%;
  42. height: auto;
  43. image{
  44. width: 100%;
  45. height: auto;
  46. }
  47. }
  48. </style>