检查地球上任何城市的当前天气。在公制和英制单位之间切换。
git clone https://github.com/qikaile/weather-app.git
cd weather-app
npm install
- 登录 Openweathermap.com
- 创建 API 密钥
cp .env.example .env.local
- 粘贴 API 密钥
OPENWEATHER_API_KEY
打开.env.local文件,修改为OPENWEATHER_API_KEY=API密钥(修改为你的API秘钥) 找到你需要的城市,打开pages文件夹下index.js文件中例:const [input, setInput] = useState("Ma'anshan"); Ma'anshan可以修改为你自己的城市 npm run dev
1、fork本项目 2、前往Vercel官网,添加新项目,导入github项目 3、Vercel 环境name为OPENWEATHER_API_KEY VALUE值为之前获取的API密钥值,添加后点击部署即可。
本项目是来自原作版:https://github.com/madzadev/weather-app,本文在此基础做了些许修改。