出现tokne自动切登录

This commit is contained in:
2020-10-14 16:21:40 +08:00
parent 5832f7a0bc
commit b41672ce8b
4 changed files with 50 additions and 13 deletions

View File

@@ -7,6 +7,7 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import router from './router';
import store from './store';
import { getValue } from './utils/common';
@@ -15,6 +16,8 @@ export default defineComponent({
if(getValue('token')){
store.commit("login", true)
store.dispatch("setUserInfo");
}else{
router.push("/")
}
}
})