使用Pinia代替Vuex进行数据存储

This commit is contained in:
RuoYi
2022-05-29 21:40:32 +08:00
parent 6f359c1534
commit 44ad220cdd
30 changed files with 479 additions and 623 deletions

View File

@ -68,8 +68,9 @@
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from "@/utils/jsencrypt";
import useUserStore from '@/store/modules/user'
const store = useStore();
const userStore = useUserStore()
const router = useRouter();
const { proxy } = getCurrentInstance();
@ -111,7 +112,7 @@ function handleLogin() {
Cookies.remove("rememberMe");
}
// 调用action的登录方法
store.dispatch("Login", loginForm.value).then(() => {
userStore.login(loginForm.value).then(() => {
router.push({ path: redirect.value || "/" });
}).catch(() => {
loading.value = false;