postMessage数据转换

This commit is contained in:
Xwen
2024-01-10 23:24:12 +08:00
parent 0287e0481c
commit ad55441bf6
2 changed files with 2 additions and 4 deletions

View File

@@ -50,11 +50,9 @@ watch(
} }
} }
window.opener.postMessage({ window.opener.postMessage({
authData: authData.value, authData: JSON.stringify(authData.value),
type: scheme.value, type: scheme.value,
}); });
console.log(authData.value);
console.log(JSON.stringify(authData.value), "发送过来的值");
message.value = "授权成功"; message.value = "授权成功";
closeWindow(); closeWindow();
} }

View File

@@ -323,7 +323,7 @@ window.addEventListener("message", async (e) => {
const { authData, type } = e.data; const { authData, type } = e.data;
console.log(authData, "传到登录页的值"); console.log(authData, "传到登录页的值");
if (authData) { if (authData) {
await loginSuccess({ data: authData }); await loginSuccess({ data: JSON.parse(authData) });
window.close(); window.close();
} }
}); });