axios+vue获取和风天气信息

本文介绍如何在vue项目中利用axios库获取和风天气API提供的实时天气信息。通过weather.js页面,展示了两次不同的请求URL,分别对应不同天气数据的获取。通过console.log(res)展示响应数据,详细解析了data.now参数,提供了和风天气实时天气页面的官方文档链接作为参考。
摘要由CSDN通过智能技术生成
效果图:


是在和风天气开发平台引用的数据

weather.html页面
 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        /*   整体大框框  */
        .search_form{
            display: flex;
            flex-direction: column;
            text-align: center;
        }
        /*input框的上方天气图片*/
        .logo img{
            width:100px;
            height:100px;
        }
        .input_text{
            width: 300px;
            height: 16px;
            border: 2px solid #c4c7ce;
            border-radius: 10px 0 0 10px;
            background: #fff;
            color: #222;
            font-size: 16px;
            padding: 12px 16px;
            margin: 0;
            box-sizing: content-box;
            outline: none;
        /*    去掉获取焦点以后的input框的边框*/
        }
        .input_btn{
            width: 108px;
            height: 44px;
            line-height: 45px;
            padding: 0;
            background-color: #4e6ef2;
            border-radius: 0 10px 10px 0;
            font-size: 17px;
            color: #fff;
            border: none;
            cursor: pointer;
        }
        /* enter触发事件    */
        ul li{
            list-style-type: none;
        }
        .weather_list{
            display:flex;
            flex-direction: row;
            justify-content:space-around;
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值