liushengqiang 1 năm trước cách đây
mục cha
commit
0a5e3a925c
1 tập tin đã thay đổi với 11 bổ sung0 xóa
  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",
+					},
+					"*"
+				);
 			}
 		};