From 004176924ce35c96600f5c18e85478944de8bec6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 14 一月 2023 16:46:50 +0800 Subject: [PATCH] 2023-01-14 --- src/tabviews/custom/components/card/prop-card/index.jsx | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index c6203d6..0bf5812 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -157,7 +157,7 @@ } componentDidMount () { - const { config } = this.state + const { config, sync } = this.state MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) @@ -171,6 +171,17 @@ if (config.timer && config.wrap.datatype === 'dynamic') { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) + } + + if (config.$cache && (config.setting.sync !== 'true' || sync)) { + Api.getLCacheConfig(config.uuid).then(res => { + if (!res) return + + let _data = res[0] + _data.$$uuid = _data[config.setting.primaryKey] || '' + + this.setState({data: _data}) + }) } } @@ -383,6 +394,10 @@ if (result.status) { let _data = {} + if (config.$cache) { + Api.writeCacheConfig(config.uuid, result.data || '') + } + if (!result.data || !result.data[0]) { _data.$$empty = true } else { -- Gitblit v1.8.0