From c0f0a6fa3d57ddefb8df07f1ce16e8b6179fe810 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 18 Jan 2022 16:52:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=98=B2=E6=AD=A2=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E4=B8=80=E7=9B=B4loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/custom-component/UserView.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 84f71aafa7..0ae214b946 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -118,9 +118,10 @@ export default { }, data() { return { + filterInit: false, // 标记是否已经通过watch.filters 进行初始化,如果filterInit=true 则create放弃数据初始化防止数据覆盖 refId: null, chart: BASE_CHART_STRING, - requestStatus: 'waiting', + requestStatus: 'success', message: null, drillClickDimensionList: [], drillFilters: [], @@ -242,7 +243,10 @@ export default { watch: { 'filters': function(val1, val2) { - isChange(val1, val2) && this.getData(this.element.propValue.viewId) + if (isChange(val1, val2)) { + this.filterInit = true + this.getData(this.element.propValue.viewId) + } }, linkageFilters: { handler(newVal, oldVal) { @@ -313,8 +317,8 @@ export default { created() { this.refId = uuid.v1 if (this.element && this.element.propValue && this.element.propValue.viewId) { - const hasFilter = this.componentData.filter(item => item.type === 'custom').some(item => item.options.value && !(item.options.value instanceof Object) || (item.options.attrs && item.options.attrs.default && item.options.attrs.default.isDynamic)) - if (!hasFilter || this.filters.length > 0) { this.getData(this.element.propValue.viewId, false) } + // 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化 + !this.filterInit && this.getData(this.element.propValue.viewId, false) } }, methods: {