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

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('login');
export default {
  created() {
    this.toLogin();
  },
  methods: {
    ...mapActions(['login']),
    async toLogin() {
      const obj = { username: 'wxyk', password: 'wxyk' };
      const res = await this.login(obj);
      if (res.code === 200) {
        const token = res.token;
        sessionStorage.setItem('token', token);
      }
    },
  },
};
</script>

<style lang="less">
p {
  padding: 0;
  margin: 0;
}
.textOver {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
