<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'app',
  data() {
    return {
    }
  },
     created () {
      //在页面加载时读取sessionStorage里的状态信息
      if (sessionStorage.getItem("store") ) {
          this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(sessionStorage.getItem("store"))))
      }

      //在页面刷新时将vuex里的信息保存到sessionStorage里
      window.addEventListener("beforeunload",() => {
          sessionStorage.setItem("store",JSON.stringify(this.$store.state))
      })
      //
      // console.log(this.$route.query.accessToken)
      // sessionStorage.setItem("accessToken", this.$route.query.accessToken);
    },
  methods: {
    initWindow() {
      let whdef = 100 / 1920 // 表示1920的设计图,使用100PX的默认值
      // let wH = window.innerHeight // 当前窗口的高度
      let wW = window.innerWidth // 当前窗口的宽度
      let rem = wW * whdef // 以默认比例值乘以当前窗口宽度,得到该宽度下的相应FONT-SIZE值
      let html = document.getElementsByTagName('html')[0]
      html.style.fontSize = rem + 'px'
    }
  },
  mounted() {
    let self = this
    this.initWindow()
    window.onresize = () => {
      self.initWindow()
    }
  }
}
</script>

<style>
@charset "utf-8";
body,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
form,
fieldset,
input,
textarea,
p,
blockquote,
th,
td,
label,
botton {
    margin: 0;
    padding: 0;
    font-size: 12px;
}
table {
    border-collapse: initial;
    border-spacing: 0;
}
fieldset,
img {
    border: 0;
}
address,
caption,
cite,
code,
dfn,
em,
strong,
th,
var {
    font-style: normal;
    font-weight: normal;
}
ol,
ul {
    list-style: none;
}
caption,
th {
    text-align: left;
}
/* h1,h2,h3,h4,h5,h6 {   
font-weight:normal;   
}    */
q:before,
q:after {
    content: "";
}
abbr,
acronym {
    border: 0;
}
* {
    margin: 0px;
    padding: 0px;
}
a {
    text-decoration: none;
}
li {
    list-style: none;
}
input,
img {
    border: none;
}
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
}
</style>
