From 36891a901af8de9b0f788a76e11a4c8b154ada8e Mon Sep 17 00:00:00 2001 From: cast1e Date: Fri, 5 Jan 2024 21:01:52 +0800 Subject: [PATCH] css bug fixes --- src/App.vue | 6 +- src/components/Manage.vue | 17 +-- src/components/Recite.vue | 217 +++++++++++++++++------------- src/components/manage/Display.vue | 89 ++++++++++++ src/components/manage/Editor.vue | 31 +++-- src/components/manage/NewSet.vue | 17 ++- src/components/manage/SetList.vue | 116 ++++++++++++---- src/router.js | 4 +- 8 files changed, 337 insertions(+), 160 deletions(-) create mode 100644 src/components/manage/Display.vue diff --git a/src/App.vue b/src/App.vue index 18049e9..bbad2e2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,5 @@ diff --git a/src/components/Recite.vue b/src/components/Recite.vue index 9447ab4..c38b295 100644 --- a/src/components/Recite.vue +++ b/src/components/Recite.vue @@ -1,89 +1,98 @@ @@ -291,6 +300,8 @@ export default { title: "Congratulations!", type: "success" }) + localStorage.removeItem("lastrecite"); + localStorage.removeItem("lastcurrent"); return; } nextTick(() => { @@ -298,8 +309,8 @@ export default { }); } else ElMessage({ - type:"error", - message:"您还未答过该词,跳过请使用ctrl+M", + type: "error", + message: "您还未答过该词,跳过请使用ctrl+M", }) }, skip() { @@ -313,13 +324,13 @@ export default { return; }, prev() { - if(this.current>0){ + if (this.current > 0) { this.current--; this.show(); } else ElMessage({ - type:'error', - message:"已经是第一个单词" + type: 'error', + message: "已经是第一个单词" }) }, showAnswer() { @@ -331,7 +342,10 @@ export default { let e = document.getElementById("input"); e.value = "_".repeat(this.word.word.length); e.setSelectionRange(0, 0); - e.style.height = `${e.scrollHeight}px`; + e.style.height = "0"; + setTimeout(() => { + e.style.height = `${e.scrollHeight}px`; + }, 200); } }, change() { @@ -353,18 +367,23 @@ export default { title: "Error", message: "错误", type: "error" - }), - o = "_".repeat(this.word.word.length); + }); + o = "_".repeat(this.word.word.length); n = 0; + e.style.height = "0"; + setTimeout(() => { + e.style.height = `${e.scrollHeight}px`; + }, 200); } else n == -1 ? o = "_".repeat(this.word.word.length) : (o = t.substring(0, n), o += "_".repeat(this.word.word.length - n)); e.value = o; e.setSelectionRange(n, n); - e.style.height = 0; setTimeout(() => { - e.style.height = `${e.scrollHeight}px`; - }, 0); + if (parseInt(e.style.height) < e.scrollHeight) { + e.style.height = `${e.scrollHeight}px`; + } + },0); e.focus(); }, audio_play() { @@ -450,7 +469,7 @@ export default { \ No newline at end of file diff --git a/src/components/manage/Editor.vue b/src/components/manage/Editor.vue index fafb9ca..0172896 100644 --- a/src/components/manage/Editor.vue +++ b/src/components/manage/Editor.vue @@ -1,9 +1,10 @@