diff --git a/src/pages/Editor.vue b/src/pages/Editor.vue index d4cd13c..fa56d19 100644 --- a/src/pages/Editor.vue +++ b/src/pages/Editor.vue @@ -33,7 +33,7 @@ function clickFuncBtn(func) { const startPos = textarea.selectionStart; // 获取焦点的起始位置 const endPos = textarea.selectionEnd; // 获取焦点的结束位置 const selectedText = textarea.value.slice(startPos, endPos); // 获取选中的文本 - let newText = ''; + let newText; if (selectedText) { newText = func.replace('[cur]', selectedText); } else { @@ -123,12 +123,13 @@ let autoSave onUnmounted(() => { clearInterval(autoSave); + autoSave = undefined; window.removeEventListener('keydown', handleKeydown); }); </script> <template> - <div class="container"> + <div class="container" :class="{'compact-form': isMobileMode}"> <div class="header"> <input placeholder="输入标题" v-model="titleInput"> </div> @@ -178,6 +179,11 @@ onUnmounted(() => { flex-direction: column; align-items: center; } +.container.compact-form { + width: 100%; + height: calc(100vh - 60px); + padding: 0; +} .theme-light .container { background: #e0e0e0; } @@ -197,6 +203,7 @@ onUnmounted(() => { background: #2a2a2a; color: white; } + .theme-light .header input { background: white; color: black; diff --git a/src/pages/demoPages/messageBoard/Board_page.vue b/src/pages/demoPages/messageBoard/Board_page.vue index 1cd31b6..ee20a98 100644 --- a/src/pages/demoPages/messageBoard/Board_page.vue +++ b/src/pages/demoPages/messageBoard/Board_page.vue @@ -1,7 +1,7 @@ <script setup> import Message from "./Message.vue"; -import {onMounted, onUnmounted, ref, watch} from "vue"; +import {onBeforeUnmount, onMounted, ref, watch} from "vue"; import api from "../../../utils/axios.js"; import store from "../../../store/index.js"; import swal from "../../../utils/sweetalert.js"; @@ -133,8 +133,9 @@ onMounted(async () => { }); let timer -onUnmounted(() => { +onBeforeUnmount(() => { clearInterval(timer); + timer = undefined; }) </script>