From 953b0d05ce58d2f9f5b1b8bac6af6e798a4f0cc3 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Sat, 4 Jan 2025 11:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E7=BC=93=E5=AD=98=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E4=B8=BA=E7=A9=BA=E4=BC=98=E5=8C=96=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/cashe.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/store/cashe.js b/store/cashe.js index c215605..a513933 100644 --- a/store/cashe.js +++ b/store/cashe.js @@ -19,7 +19,6 @@ class CACHE { throw (new Error('请传入缓存name值:index | {name:index}')) return } - this._isEmpty=Object.keys(data).length>=2?false:true; for (let i in data) { this[i] = data[i] const canWrite = i.slice(0, 1) !== '_' @@ -31,12 +30,16 @@ class CACHE { } } + isEmpty(){ + return Object.keys(this).length>=2?false:true; + } get(key) { return this[key] } set(key, val) { this[key] = val uni.setStorageSync(this._name, this) + this._isEmpty=false } clear() { Object.keys(this).map(v => {