登录页添加loading效果

This commit is contained in:
dong 2023-11-27 13:26:44 +08:00
parent 4bf4aa13d7
commit 1f6e55a0dc

View File

@ -48,6 +48,7 @@
</q-card> </q-card>
</q-page> </q-page>
</q-page-container> </q-page-container>
<q-inner-loading :showing="visible" />
</q-layout> </q-layout>
</template> </template>
@ -56,7 +57,7 @@ import { useQuasar } from 'quasar';
import { ApiError } from 'src/boot/axios'; import { ApiError } from 'src/boot/axios';
import { login } from 'src/api/UserApi'; import { login } from 'src/api/UserApi';
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage'; import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
import { reactive } from 'vue'; import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const $q = useQuasar(); const $q = useQuasar();
@ -69,6 +70,7 @@ const loginInfo = reactive({
async function doLogin() { async function doLogin() {
try { try {
visible.value = true;
clearJwtToken(); clearJwtToken();
const token = await login(loginInfo); const token = await login(loginInfo);
saveJwtToken(token); saveJwtToken(token);
@ -81,6 +83,8 @@ async function doLogin() {
}); });
} }
} }
const visible = ref(false);
</script> </script>
<style scoped> <style scoped>