修复在离开留言板后自动刷新仍然工作的bug

新增编辑器自动缩边
This commit is contained in:
Guarp 2025-02-24 22:16:59 +08:00
parent 7d7e2ccf87
commit d8a524eca2
2 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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>