From baabad2e5a1d26e8b4b6deed3d8b16cd8705490e Mon Sep 17 00:00:00 2001 From: mullins <476823686@qq.com> Date: Wed, 24 Jun 2020 20:05:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HMFilterDropdown/HMFilterDropdown.vue | 37 ++++++++-------------- src/pages/index/index.vue | 20 +++++++++--- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/components/HMFilterDropdown/HMFilterDropdown.vue b/src/components/HMFilterDropdown/HMFilterDropdown.vue index 5d3b601..020ce92 100644 --- a/src/components/HMFilterDropdown/HMFilterDropdown.vue +++ b/src/components/HMFilterDropdown/HMFilterDropdown.vue @@ -314,6 +314,7 @@ export default { }, // 重置结果和ui,筛选 resetFilterData (pageIndex) { + console.log('pageIndex', pageIndex) const tmpArr = [] let level = this.shadowActiveMenuArr[pageIndex].length while (level > 0) { @@ -348,7 +349,6 @@ export default { this.selectedData[`${data[box_index].value}`] = [] this.selectedData[`${data[box_index].value}`].push(data[box_index].submenu[label_index].value) } else { - console.log('---', data, this.filterData, this.selectedData) this.selectedData[`${data[box_index].value}`].push(data[box_index].submenu[label_index].value) } // this.selectedData[`${data[box_index].value}`].push(data[box_index][label_index]) @@ -373,9 +373,9 @@ export default { }, // 菜单开关 togglePage (index, isRequest = true) { - if (!isRequest && this.maskVisibility) { - return - } + // if (!isRequest && this.maskVisibility) { + // return + // } if (index === this.showPage) { this.hidePageLayer(true, isRequest) this.hideMask() @@ -392,10 +392,12 @@ export default { } this.on[index] = 1 }, + // 展示全部 showAll () { this.on = [1, 0, 0, 0, 0] this.showPage = -1 - console.log('showPage-', this.showPage) + this.resetFilterData(4) + this.hideMask() // 输出 this.$emit('search', { index: {}, @@ -483,24 +485,13 @@ export default { } index[i] = item }) - const params = this.selectedData - console.log('params--1', params) - for (const key in params) { - if (params[key].length === 0) { - delete params[key] - } - } - // 若筛选未选择 - if (Object.getOwnPropertyNames(params).length === 1) { - this.showAll() - } else { - this.$emit('search', { - index: index, - value: value, - on: this.on, - selectedData: params, - }) - } + console.log('this.selectedData', this.selectedData) + this.$emit('search', { + index: index, + value: value, + on: this.on, + selectedData: this.selectedData, + }) }, // show菜单页 showPageLayer (index) { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1bc50a6..76182eb 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -259,7 +259,6 @@ export default { const { on, value, selectedData } = e let params = {} const selectedPayload = {} - console.log('on-----', on) // 将传入数组字符串化 for (const key in selectedData) { if (Object.prototype.hasOwnProperty.call(selectedData, key)) { @@ -287,10 +286,21 @@ export default { } } } - store.dispatch('index/search', { - params, - keyword: this.keyWords, - }) + console.log('params', params) + for (const key in params) { + if (params[key].length === 0) { + delete params[key] + } + } + // 若筛选未选择 + if (Object.getOwnPropertyNames(params).length === 1) { + store.dispatch('index/list') + } else { + store.dispatch('index/search', { + params, + keyword: this.keyWords, + }) + } } }, }, -- 2.0.0