<template>
    <el-card>
        <div slot="header" class="date">
            {{date}}
        </div>
    </el-card>
</template>

<script>
    import {format} from 'date-fns'
    import zh from 'date-fns/locale/zh_cn'
    import axios from 'axios'

    export default {
        created() {
            axios.get('http://api.openweathermap.org/data/2.5/weather', {
                params: {
                    q: 'nanjing,cn',
                    appid: 'a3e7bdc246b811691b06aab13ccb0dbb',
                    lang: 'zh'
                },
                withCredentials: false
            }).then(res => {
                console.log(res)
            })
        },
        data() {
            return {
                date: format(new Date(), 'YYYY/MM/DD dddd', {locale: zh})
            }
        },
        computed: {}
    }
</script>

<style lang="less" scoped>
    .date {
        color: #666;
    }
</style>
