1. <template>
    2. <view class='goods_detail'>
    3. <swiper indicator-dots>
    4. <swiper-item v-for="(item,index) in swipers" :key="index">
    5. <image :src='item.src'></image>
    6. </swiper-item>
    7. </swiper>
    8. </view>
    9. </template>
    10. <script>
    11. export default {
    12. data() {
    13. return {
    14. id : 0,
    15. swipers:[]
    16. }
    17. },
    18. methods: {
    19. //获取轮播图的数据,首先会有函数
    20. async getSwipers(){
    21. const res = await this.$myRequest({
    22. url:'/api/getthumimages/'+this.id
    23. })
    24. this.swipers = res.data.message
    25. }
    26. },
    27. onLoad(options){
    28. // console.log(options)
    29. this.id = options.id
    30. this.getSwipers()
    31. }
    32. }
    33. </script>
    34. <style lang="scss">
    35. .goods_detail{
    36. swiper{
    37. height:750rpx;
    38. image{
    39. width:100%;
    40. height:100%;
    41. }
    42. }
    43. }
    44. </style>

    获取到地址栏参数,是通过onload加载中的options获取得到的。