liushengqiang 1 年之前
父节点
当前提交
0a5e3a925c
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/pc/home/index.tsx

+ 11 - 0
src/pc/home/index.tsx

@@ -580,8 +580,10 @@ export default defineComponent({
 
 		const handleClose = () => {
 			// 判断是否在应用中
+			console.log("点击退出", window.matchMedia("(display-mode: standalone)").matches);
 			if (window.matchMedia("(display-mode: standalone)").matches) {
 				window.onbeforeunload = null;
+				console.log("准备发消息");
 				window.parent.postMessage(
 					{
 						api: "notation_exit",
@@ -590,6 +592,15 @@ export default defineComponent({
 				);
 			} else {
 				window.close();
+				// 全屏模式无法判断是否在应用打开
+
+				// 那就都发个消息吧
+				window.parent.postMessage(
+					{
+						api: "notation_exit",
+					},
+					"*"
+				);
 			}
 		};