<template>
    <div class="date-timer">
        <ul>
            <li id="Y"></li>
            <li id="MH"></li>
            <li id="TD"></li>
        </ul>
        <!-- <em id="D"></em> -->
        <p>
            <span id="H" style="width: 30px;"></span>
            <span>:</span>
            <span id="M" style="width: 30px;"></span>
            <span>:</span>
            <span id="S" class="hide" style="width: 30px;"></span>
        </p>
    </div>
</template>

<script>
 // 时间区
 $(document).ready(function(){
     setInterval(showTime, 1000);
     function timer(obj,txt){
         obj.text(txt);
     }
     function showTime(){
         var today = new Date();
         var weekday=new Array(7);
         weekday[1]="星期一"
         weekday[2]="星期二"
         weekday[3]="星期三"
         weekday[4]="星期四"
         weekday[5]="星期五"
         weekday[6]="星期六"
         weekday[0]="星期日"
         var y=today.getFullYear()+"年";
         var month=today.getMonth()+1+"月";
         var td=today.getDate()+"日";
         var d=weekday[today.getDay()];
         var h=today.getHours();
         var m=today.getMinutes();
         var s=today.getSeconds();
         if(h<10){
             h="0"+h;
         }
         if(m<10){
             m="0"+m;
         }
         if(s<10){
           s = "0"+s;
         }
         timer($("#Y"),y);
         timer($("#MH"),month);
         timer($("#TD"),td);
         timer($("#D"),d);
         timer($("#H"),h);
         timer($("#M"),m);
         timer($("#S"),s);
     }

 })

</script>

<style>


</style>
