3***@qq.com
3***@qq.com
  • 发布:2024-12-21 17:18
  • 更新:2024-12-21 17:18
  • 阅读:95

uniApp开发vue页面网络请求正常,nvue页面网络请求没有反应

分类:nvue

async initData() {

            const res = await uni.request({  
                url: 'interfaces/index/index', // 替换为真实API地址  
                method: 'GET',  
                header: {  
                    'Content-Type': 'application/json',  
                },  
                success: (res) => {  
                    if (res.code === 200) {  
                        const data = res.data  
                        const last_page = data.last_page  

                        this.haveMoreData = this.currentPage < last_page  
                        if (this.currentPage === 1) {  

                            this.list = data.data  
                        } else {  
                            this.list = this.list.concat(data.data)  
                        }  

                        this.list.forEach(item => {  
                            if (!item.picurl || item.picurl.trim() === '') {  
                                item.picurl =  
                                    'https://pic3.58cdn.com.cn/p1/big/n_v399070eb97c2344a7acc5d6f97a02f27c.jpg';  
                            }  
                        })  
                        setTimeout(() => {  
                            this.list = this.list  
                        })  
                        console.log("list=======", JSON.stringify(this.list));  
                    }  
                },  
                fail: (error) => {  
                    console.log("list===error====", JSON.stringify(error));  

                },  
            });}
2024-12-21 17:18 负责人:无 分享
已邀请:

要回复问题请先登录注册