perf:优化未登陆时的跳转路由体验

This commit is contained in:
Xwen
2023-12-16 22:46:10 +08:00
parent 6fd7baa10f
commit 0d5e993042
3 changed files with 16 additions and 9 deletions

View File

@@ -69,14 +69,16 @@
<script setup>
import AvatarInfo from "@/components/AvatarInfo.vue";
import { ref } from "vue";
import { useRouter } from "vue-router";
import { useRoute, useRouter } from "vue-router";
import useUserStore from "@/stores/user.js";
import useConfigStore from "@/stores/config";
import useAuths from "@/hooks/useAuths";
import { Session } from "@/utils/storage";
const { getToken } = useAuths();
const configStore = useConfigStore();
const router = useRouter();
const route = useRoute();
const userStore = useUserStore();
const activeIndex = ref("1");
const searchText = ref("");
@@ -106,6 +108,7 @@ const enterProfile = () => {
router.push("/profile");
};
const toLogin = () => {
Session.set("currentPath", route.path);
router.push("/login");
};
const search = () => {