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

<script>
import { setToken } from '@/utils/auth'
export default {
  name: 'App',
  created() {
    console.log(this.$root);
    if (this.$root.parentStore) {
      let token = this.$root.parentStore.state.user.token;
      console.log('mall:' + token);
      this.$store.commit('SET_TOKEN', token);
      setToken(token);
    }
    this.sleep(200);

  },
  methods: {
    sleep(delay) {
      var start = (new Date()).getTime();
      while ((new Date()).getTime() - start < delay) {
        continue;
      }
    },
  }
}
</script>
