diff --git a/src/components/lib/AjaxTable.vue b/src/components/lib/AjaxTable.vue index 6f9d2fc6..01f21b22 100644 --- a/src/components/lib/AjaxTable.vue +++ b/src/components/lib/AjaxTable.vue @@ -45,6 +45,7 @@ export default { this.load_data(); }, load_data() { + let limit = this.limit; this.loading = true; this.$axios .get(this.ajax_url, { @@ -54,9 +55,11 @@ export default { } }) .then(res => { - this.total = res.data.count; - this.tableData = res.data.res.map(this.process); - this.loading = false; + if (limit === this.limit) { + this.total = res.data.count; + this.tableData = res.data.res.map(this.process); + this.loading = false; + } }) .catch(err => { this.$SegmentMessage.error(this, '[Ajax Table] Request Failed'); diff --git a/src/components/problem/listTag.vue b/src/components/problem/listTag.vue index 4aa13a6b..0bc4fdac 100644 --- a/src/components/problem/listTag.vue +++ b/src/components/problem/listTag.vue @@ -17,45 +17,64 @@ diff --git a/src/methods/lock.js b/src/methods/lock.js new file mode 100644 index 00000000..f4e9aa68 --- /dev/null +++ b/src/methods/lock.js @@ -0,0 +1,27 @@ +class AWaitLock { + constructor() { + this.lockQueue = []; + this.locked = false; + } + + async acquire() { + if (this.locked) { + let that = this; + await new Promise((resolve) => { + that.lockQueue.push(resolve); + }); + } + this.locked = true; + return true; + } + + release() { + this.locked = false; + let resolve = this.lockQueue.pop(); + if (resolve) { + resolve(); + } + } +} + +export default AWaitLock; \ No newline at end of file diff --git a/src/store/tags.js b/src/store/tags.js index 5342f35d..f1f6853b 100644 --- a/src/store/tags.js +++ b/src/store/tags.js @@ -1,6 +1,8 @@ const tagsstore = { state: { - displayTags: false + displayTags: false, + tagsData: new Array(), + tagsLock: new Array() }, mutations: { setDisplayTag(state, data) {