This is a weather query application based on Nuxt3, where users can input a location to query the current weather information.
- Location Input: Users can input a location to query the weather.
- Weather Display: Displays the current weather icon, temperature, and description.
- Humidity and Wind Speed: Displays the current humidity and wind speed.
- Error Handling: Displays an error message when the input location cannot be found.
- Nuxt3: A framework for building Vue.js applications.
- Vue 3: A JavaScript framework for building user interfaces.
- Axios: A library for making HTTP requests.
- OpenWeatherMap API: An API for fetching weather data.
-
Clone the repository
git clone https://github.com/yourusername/weather-app.git
-
Enter the project directory
cd weather-app
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser and visit
http://localhost:3000
In the pages/index.vue
file, find the following code and replace it with your OpenWeatherMap API key:
const weatherResponse = await axios.get(
"https://api.openweathermap.org/data/2.5/weather",
{
params: {
q: location.value,
appid: "your API key",
units: "metric",
},
}
);
weather-app/
├── assets/
├── components/
├── layouts/
├── pages/
│ └── index.vue
├── plugins/
├── static/
├── store/
├── README.md
└── nuxt.config.js
Feel free to submit issues and pull requests.