feat:授权成功后也关闭弹窗

This commit is contained in:
Xwen
2024-01-10 22:07:29 +08:00
parent ce667a9f9e
commit 6bec250f6c

View File

@@ -15,6 +15,11 @@ const type = ref(route.query.state);
const message = ref("");
const scheme = ref("");
const authData = ref("");
const closeWindow = () => {
setTimeout(() => {
window.close();
}, 2000);
};
watch(
() => code.value,
async (val) => {
@@ -41,17 +46,15 @@ watch(
}
} catch (error) {
if (error.status === 403) {
setTimeout(() => {
window.close();
}, 3000);
closeWindow();
}
}
window.opener.postMessage({
authData: JSON.stringify(authData.value),
type: scheme.value,
});
console.log(authData.value, "我是打开的窗口页");
message.value = "授权成功";
closeWindow();
}
},
{ immediate: true }