From 14764dd7679369a650ad1d60be62aacc863755a1 Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期四, 22 五月 2025 16:29:01 +0800 Subject: [PATCH] 3 --- mixin/mixin.js | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mixin/mixin.js b/mixin/mixin.js index ad5ad6e..2fae82f 100644 --- a/mixin/mixin.js +++ b/mixin/mixin.js @@ -35,7 +35,7 @@ }, data() { return { - list: [], + baseList: [], query: {}, page: { size: 10, @@ -45,7 +45,7 @@ style: { 'color': '#fff' }, - listApi: '', + baseListApi: '', // regUserName: '用户-' + this.getRandomName(Math.floor(Math.random() * (6 - 2) + 3)), // regAvatarUrl: 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png', regUserName: '', @@ -107,11 +107,11 @@ await this.getList(type) }, async getList(type = 'get') { - if (this.listApi) { + if (this.baseListApi) { this.$message.showLoading() const { data - } = await this.$http.request(type, this.listApi, { + } = await this.$http.request(type, this.baseListApi, { params: { ...this.query, ...this.page @@ -123,16 +123,16 @@ }) if (data) { if (data && Array.isArray(data)) { - this.list = data || [] + this.baseList = data || [] this.page.total = data.length || 0 } else { if (this.page.current === 1) { - this.list = data.records || [] + this.baseList = data.records || [] } else { //根据id去重正常 var ids = [] var idsMap = {} - for (var item of this.list) { + for (var item of this.baseList) { ids.push(item.id) if (item.id) { idsMap[item.id] = item @@ -141,7 +141,7 @@ var hasnew = false for (var item of data.records) { if (ids.indexOf(item.id) < 0) { - this.list.push(item) + this.baseList.push(item) } else { //最好更新一下 idsMap[item.id] = { -- Gitblit v1.9.3