add 添加一个缓存方案

This commit is contained in:
lb
2023-10-20 14:22:46 +08:00
parent 6b4e906e75
commit 15da20fac7
6 changed files with 298 additions and 15 deletions

View File

@@ -106,6 +106,7 @@
<script>
import { getAccessToken } from '@/utils/auth';
import tupleImg from '@/assets/images/tuple.png';
import cache from '@/views/extend/processFlow/cache';
/**
* 找到最长的label
@@ -133,7 +134,7 @@ const uploadedFile = {
},
methods: {
handleDelete() {
console.log('emit delete event')
console.log('emit delete event');
this.$emit('delete', this.file);
},
},
@@ -188,6 +189,10 @@ export default {
type: Boolean,
default: false,
},
hasFiles: {
type: Boolean,
default: false,
},
labelPosition: {
type: String,
default: 'right',
@@ -231,7 +236,9 @@ export default {
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
this.form.files = this.form.files ?? [];
if (this.hasFiles) {
this.form.files = this.form.files ?? [];
}
},
deep: true,
immediate: true,
@@ -310,6 +317,11 @@ export default {
'list' in response.data
? response.data.list
: response.data;
if (opt.cache) {
cache.store(opt.cache, list);
}
this.$set(
this.optionListOf,
opt.prop,
@@ -369,7 +381,9 @@ export default {
},
handleDeleteFile(file) {
this.form.files = this.form.files.filter(item => item.fileUrl != file.fileUrl);
this.form.files = this.form.files.filter(
(item) => item.fileUrl != file.fileUrl
);
this.$emit('update', this.form);
},
},