Merge pull request #90 from cshaptx4869/patch-52

refactor: ♻️ 修正登录表单的Ref类型
This commit is contained in:
Ray Hao
2024-05-11 15:40:22 +08:00
committed by GitHub
2 changed files with 7 additions and 9 deletions

View File

@@ -9,8 +9,8 @@
<div class="flex-center">
<el-switch
v-model="isDark"
:active-icon="Moon"
:inactive-icon="Sunny"
active-icon="Moon"
inactive-icon="Sunny"
@change="changeTheme"
/>
</div>
@@ -56,7 +56,6 @@
<script setup lang="ts">
import { useSettingsStore, usePermissionStore, useAppStore } from "@/store";
import { Sunny, Moon } from "@element-plus/icons-vue";
import { LayoutEnum } from "@/enums/LayoutEnum";
import { ThemeEnum } from "@/enums/ThemeEnum";

View File

@@ -5,8 +5,8 @@
<el-switch
v-model="isDark"
inline-prompt
:active-icon="Moon"
:inactive-icon="Sunny"
active-icon="Moon"
inactive-icon="Sunny"
@change="toggleTheme"
/>
<lang-select class="ml-2 cursor-pointer" />
@@ -117,7 +117,7 @@
import { useSettingsStore, useUserStore } from "@/store";
import AuthAPI from "@/api/auth";
import { LoginData } from "@/api/auth/model";
import { Sunny, Moon } from "@element-plus/icons-vue";
import type { FormInstance } from "element-plus";
import { LocationQuery, LocationQueryValue, useRoute } from "vue-router";
import router from "@/router";
import defaultSettings from "@/settings";
@@ -136,7 +136,7 @@ const icpVisible = ref(true);
const loading = ref(false); // 按钮loading
const isCapslock = ref(false); // 是否大写锁定
const captchaBase64 = ref(); // 验证码图片Base64字符串
const loginFormRef = ref(ElForm); // 登录表单ref
const loginFormRef = ref<FormInstance>(); // 登录表单ref
const { height } = useWindowSize();
const loginData = ref<LoginData>({
@@ -186,7 +186,7 @@ function getCaptcha() {
/** 登录 */
const route = useRoute();
function handleLogin() {
loginFormRef.value.validate((valid: boolean) => {
loginFormRef.value?.validate((valid: boolean) => {
if (valid) {
loading.value = true;
userStore
@@ -285,4 +285,3 @@ html.dark .login-container {
}
}
</style>
@/api/auth/model