老衲as用飘柔 2022-10-10 17:00 采纳率: 100%
浏览 49
已结题

uni-app请求数据报错,页面无法渲染

img

<template>
    <view class="info">
        
        <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
            <swiper-item v-for="item in productDetail" :key="item.id">
                <image :src="item.pic"></image>
                <view class="swiper-item"></view>
            </swiper-item>
        </swiper>
    </view>
</template>

<script>
    import {
        productDetail
    } from "@/api/kind/kindList/info/info.js"
    export default {
        data() {
            return {
                productDetail: {},
            };
        },
        onLoad(options) {
            productDetail(options.id).then(res => {
                console.log("商品详情", res);
                this.productDetail = res.data.product;
            })
        }
    }
</script>

<style lang="scss" scoped>
    @import 'info.scss'
</style>

请问一下上面这个报错怎么解决,无法读取id,但是我数据请求成功了,就是这个id的地方报错,导致数据不能在页面显示出来

  • 写回答

5条回答 默认 最新

  • 你好!机器人 2022-10-10 17:31
    关注

    在这里打印options,应该是个undefined
    加一个console.log(options)

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

问题事件

  • 系统已结题 10月19日
  • 已采纳回答 10月11日
  • 创建了问题 10月10日

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题