<template>
  <div id="app">
    <router-view/>
  </div>
</template>
<script>
export default {
  data() {
    return {
      resizeTime: true,
    };
  },
  mounted(){
    this.getWeater()
    window.addEventListener("resize", () => this.resizeTimeActions(), true);
  },
  methods:{
    resizeTimeActions() {
      if (!this.resizeTime) return;
      this.resizeTime = false;
      setTimeout(() => {
        this.resizeTime = true;
        this.$store.commit("changClient",  document.documentElement.clientWidth + document.documentElement.clientHeight);
      }, 300);
    },
    async getWeater(){
        let res = await this.$axios.get('/top/listWeather?'+this.$qs.stringify({
        area: '上海市'
      }))
      if(res.success){
        this.$store.commit("changWeater", res.data.showapi_res_body.now);
      }
    }
  }
}
</script>
<style lang="scss">
#app {
  width: 100%;
  height: 100%;
}
</style>
