1
0
Files
frost-zx.github.io/docs/content/post-2025-02-11-1.md
2025-10-13 10:20:34 +08:00

33 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "在用 uni-app 开发钉钉小程序的时候遇到一个奇怪的问题,发送请求拿不到返回的数据"
date: 2025-02-11T20:55:40Z
lastmod: 2025-02-12T09:51:42Z
tags: [Web 前端,uni-app,小程序]
---
# 在用 uni-app 开发钉钉小程序的时候遇到一个奇怪的问题,发送请求拿不到返回的数据
今天我一位同事说用 uni-app 新开发的钉钉小程序里发送请求拿不到返回的数据看了下发现调试工具的“Network”栏里显示请求是发送成功的也有返回数据但是没触发请求的回调函数。
原本用的是 `luch-request` 这个库发送的请求,后来试了下 uni-app 内置的 `uni.request` 以及钉钉的 `dd.httpRequest` 都是一样不行。
![](assets/network-asset-3280690-20250211195905643-857124077-20250212095147-hh7adaw.png)
![](assets/network-asset-3280690-20250211195912787-1505858752-20250212095147-uz3bwp6.png)
![](assets/network-asset-3280690-20250211195916244-60822353-20250212095147-qbjotgw.png)
再后来重新创建一个新的项目试了一下是可以的,就觉得是版本的问题,然而把依赖项的版本改成和新建的一样了也不行。
![](assets/network-asset-3280690-20250211201344508-763916890-20250212095148-fijensv.png)
![](assets/network-asset-3280690-20250211201431143-429830505-20250212095148-k78zhfr.png)
看来看去,最后发现原来是这个 `options.value = options` 导致的(刚开始试过在 `App.vue` 里写请求也不行就没怎么在意这里),把它去掉就正常了。
![](assets/network-asset-3280690-20250211195920444-892198191-20250212095148-t4npl5e.png)
![](assets/network-asset-3280690-20250211195924953-725130489-20250212095148-ghq3gp3.png)
然后试了下在新创建的项目里写上这个 `options.value = options`,但是这个问题并没有出现。