From d3a29444bfedbf8db3ce540c73fb2de0a29951f1 Mon Sep 17 00:00:00 2001 From: Jesse-Ma <24167796@qq.com> Date: Fri, 31 Mar 2023 17:19:37 +0800 Subject: [PATCH] refresh save --- src/views/EditNote.vue | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/views/EditNote.vue b/src/views/EditNote.vue index cd2027a..f195c04 100644 --- a/src/views/EditNote.vue +++ b/src/views/EditNote.vue @@ -379,27 +379,27 @@ export default { backStoreFunction() { let that = this; return function () { - that.backStoreText(that); + that.backStoreText(); } }, - backStoreText(that) { - let nowEditCount = that.noteForm.text.length; + backStoreText() { + let nowEditCount = this.noteForm.text.length; let nowEditTime = new Date().getTime(); - if (Math.abs(nowEditCount - that.lastStoreCount) > 10) { - setStoreText(that.noteForm, that.state, that.secret); - that.lastStoreTime = that.lastEditTime; - that.lastStoreCount = nowEditCount; + if (Math.abs(nowEditCount - this.lastStoreCount) > 10) { + setStoreText(this.noteForm, this.state, this.secret); + this.lastStoreTime = this.lastEditTime; + this.lastStoreCount = nowEditCount; } else { - if (nowEditTime - that.lastEditTime >= 1000 && nowEditTime - that.lastEditTime < 20000) { - if (that.lastEditTime != that.lastStoreTime) { - setStoreText(that.noteForm, that.state, that.secret); - that.lastStoreTime = that.lastEditTime; - that.lastStoreCount = nowEditCount; + if (nowEditTime - this.lastEditTime >= 1000 && nowEditTime - this.lastEditTime < 20000) { + if (this.lastEditTime != this.lastStoreTime) { + setStoreText(this.noteForm, this.state, this.secret); + this.lastStoreTime = this.lastEditTime; + this.lastStoreCount = nowEditCount; } - } else if (nowEditTime - that.lastEditTime >= 20000) { - if (that.backStoreTextInterval != null) { - let ivl = that.backStoreTextInterval; - that.backStoreTextInterval = null; + } else if (nowEditTime - this.lastEditTime >= 20000) { + if (this.backStoreTextInterval != null) { + let ivl = this.backStoreTextInterval; + this.backStoreTextInterval = null; window.clearInterval(ivl); } } @@ -602,7 +602,7 @@ export default { }); }, beforeunloadHandler() { - this.recordText(); + setStoreText(this.noteForm, this.state, this.secret); }, } }