<template>
           <!-- <div class="nav-header" >头部导航区域  </div> -->
           <header>
            <div class="header-logo">
                <div class="weather">多云 8℃ 东南风3-4级
                </div>
                <div class="showTime "></div>
            </div>
        </header>
       
</template>

<script>
import  '../../assets/homeStatic/js/flexible.js';
import  '../../assets/homeStatic/js/jquery.js';

//获取时间
var t = null;
t = setTimeout(time, 1000); //開始运行
function time() {
    clearTimeout(t); //清除定时器
    var dt = new Date();
    var y = dt.getFullYear();
    var mt = Appendzero(dt.getMonth() + 1);
    var day = Appendzero(dt.getDate());
    var h = Appendzero(dt.getHours()); //获取时
    var m = Appendzero(dt.getMinutes()); //获取分
    var s = Appendzero(dt.getSeconds()); //获取秒
    document.querySelector(".showTime").innerHTML =

        y +
        "-" +
        mt +
        "-" +
        day +
        " " +
        h +
        ":" +
        m +
        ":" +
        s;
    t = setTimeout(time, 1000); //设定定时器，循环运行
}

/* 个位补零*/
function Appendzero(obj) {
    if (obj < 10) return "0" + obj;
    else return obj;
}

function add0(m) { return m < 10 ? '0' + m : m }


//获取天气
// $(function() {
//     $.ajax({
//         url: "https://api.asilu.com/weather/",
//         type: 'GET',
//         dataType: 'jsonp',
//         data: {
//             "key": "adfdb863ddb1101bb6b40c0700d6203b",
//         },
//         success: function(html) {
//             var str = "";
//             str += "<span>" + html.city + "</span>";
//             // str += "<span>" + html.weather[0].date + "</span>";
//             str += "<span>" + html.weather[0].weather + "</span>";
//             str += "<span>" + html.weather[0].temp + "</span>";
//             str += "<span>" + html.weather[0].wind + "</span>";
//             str += "</tr>";
//             $(".weather").html(str)
//         }
//     });
// })



export default {
    name: 'HeaderTop',
   
  
  
}
</script>

<style lang="scss" scoped>

header {
    width: 100%;
    height: 1.3125rem;
    text-align: center;
    color: #00F6FF;
    position: relative;
    z-index:99999999;
    position:fixed;
}

.header-logo {
    /* height: 1.3125rem; */
    /* top:0;
   left:50%; */
    height: 1.3125rem;
    width: 100%;
    background-image: url(../../assets/homeStatic/images/header-logo.png);
    background-size: contain;
    background-position: top center;
    display: inline-block;
    background-repeat: no-repeat
}

header .weather {
    position: absolute;
    top: .2rem;
    left: .7rem;
    font-size: .25rem;
}

header .weather span {
    display: inline-block;
    margin-right: 30px
}

header .showTime {
    position: absolute;
    top: .2rem;
    right: .7rem;
    font-size: .25rem;
}

</style>
