From d2770cdeaa6e2ca94977b61650472429291ecd4d Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Sat, 17 Sep 2022 20:17:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4preload=E4=B8=AD?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E7=9B=B8=E5=85=B3=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/preload.js | 12 +++--------- src/cpns/ClipOperate.vue | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/public/preload.js b/public/preload.js index e8ad4ba..a53eb99 100644 --- a/public/preload.js +++ b/public/preload.js @@ -41,9 +41,7 @@ class DB { // 将超过14天的数据删除 排除掉收藏 const now = new Date().getTime() const deleteTime = now - '\u0031\u0034' * '\u0032\u0034' * 60 * 60 * 1000 // unicode - this.dataBase.data = this.dataBase.data?.filter( - (item) => item.updateTime > deleteTime || item.collect - ) + this.dataBase.data = this.dataBase.data?.filter((item) => item.updateTime > deleteTime) this.updateDataBaseLocal() } catch (err) { utools.showNotification('读取剪切板出错: ' + err) @@ -77,14 +75,10 @@ class DB { this.updateDataBase() const exceedCount = this.dataBase.data.length - '\u0038\u0030\u0030' if (exceedCount > 0) { - // 达到条数限制 在收藏条数限制内遍历非收藏历史并删除 - // 所有被移除的 item都存入tempList - const tmpList = [] + // 达到条数限制 删除超出部分 for (let i = 0; i < exceedCount; i++) { - const item = this.dataBase.data.pop() - tmpList.push(item) + this.dataBase.data.pop() } - tmpList.forEach((item) => !item.collect || this.dataBase.data.push(item)) // 收藏内容 重新入栈 } this.updateDataBaseLocal() } diff --git a/src/cpns/ClipOperate.vue b/src/cpns/ClipOperate.vue index aed57b8..eae0388 100644 --- a/src/cpns/ClipOperate.vue +++ b/src/cpns/ClipOperate.vue @@ -8,7 +8,7 @@ id !== 'open-folder' && id !== 'word-break' && id !== 'save-file') || - (id === 'collect' && item.collect !== true) || + (id === 'collect' && item.type !== 'file') || (id === 'view' && !isFullData) || (id === 'open-folder' && item.type === 'file') || (id === 'save-file' && isFullData && item.type !== 'file') ||