From ead431bc9c70f0e78cc548a8e3f40191fced1990 Mon Sep 17 00:00:00 2001 From: xjs <1294405880@qq.com> Date: Sun, 20 Mar 2022 23:29:38 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=8F=91=E5=B8=83=E5=95=86=E5=93=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/components/mall/brand-select.vue | 19 ++++++++++++++++--- .../components/mall/category-cascader.vue | 5 +++++ .../views/mall/product/maintain/spuadd.vue | 8 ++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ruoyi-ui/src/views/components/mall/brand-select.vue b/ruoyi-ui/src/views/components/mall/brand-select.vue index 6360ac56..d51191bd 100644 --- a/ruoyi-ui/src/views/components/mall/brand-select.vue +++ b/ruoyi-ui/src/views/components/mall/brand-select.vue @@ -45,9 +45,11 @@ export default { let catId = { brand: this.catId } - catelogList(catId).then(res => { - this.brands = res.data; - }) + if (this.catId) { + catelogList(catId).then(res => { + this.brands = res.data; + }) + } }, }, @@ -55,6 +57,17 @@ export default { created() { }, mounted() { + //监听清空选中值 + this.$bus.$on('clearBrandSelect', data => { + this.brands = [ + { + label: null, + value: null + } + ] + this.brandId = null + }) + //监听三级分类消息的变化 this.subscribe = PubSub.subscribe("catPath", (msg, val) => { this.catId = val[val.length - 1]; diff --git a/ruoyi-ui/src/views/components/mall/category-cascader.vue b/ruoyi-ui/src/views/components/mall/category-cascader.vue index de910aa3..1532c8a9 100644 --- a/ruoyi-ui/src/views/components/mall/category-cascader.vue +++ b/ruoyi-ui/src/views/components/mall/category-cascader.vue @@ -68,6 +68,11 @@ export default { }, mounted() { + this.$bus.$on('clearCategoryCascader', data => { + this.paths = data + }) + + } }; diff --git a/ruoyi-ui/src/views/mall/product/maintain/spuadd.vue b/ruoyi-ui/src/views/mall/product/maintain/spuadd.vue index 1c2f6220..6639319e 100644 --- a/ruoyi-ui/src/views/mall/product/maintain/spuadd.vue +++ b/ruoyi-ui/src/views/mall/product/maintain/spuadd.vue @@ -346,9 +346,9 @@ - 继续添加 @@ -469,7 +469,7 @@ export default { this.spu = { spuName: "", spuDescription: "", - catalogId: 0, + catalogId: "", brandId: "", weight: "", publishStatus: 0, @@ -484,6 +484,10 @@ export default { }; //清空子组件的值 + this.$bus.$emit('clearCategoryCascader',[]) + this.$bus.$emit('clearBrandSelect',[]) + + }, handlePriceChange(scope, mpidx, e) {