You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
站点链接
https://github.com/YanAnghelp/home
问题描述
No response
补充信息
高德IP的API必须添加&ip=参数,否则输出空白,这是高德BUG。
以下是我对 src/api/index.js 改进的部分代码:
// 获取高德地理位置信息
export const getAdcode = async (key) => {
const ip_response = await fetch('https://get-ip.xxxx.com/api');
const ip_data = await ip_response.json();
const userIp = ip_data.ip;
const res = await fetch(
https://restapi.amap.com/v3/ip?key=${key}&ip=${userIp});return await res.json();
};
get-ip是个我随手写的获取用户ip的小项目,用next.js,兼容CORS,项目已经开源,随便用https://github.com/YanAnghelp/get-ip