diff --git a/src/components/SelectionPath.vue b/src/components/SelectionPath.vue index 05ae588..7d3f43a 100644 --- a/src/components/SelectionPath.vue +++ b/src/components/SelectionPath.vue @@ -73,9 +73,14 @@ export default { }, watch: { categoryList (val) { - if (this.defaultPath !== '') { - this.form.path = this.defaultPath + if (this.defaultPath !== '') { // 首先 默认不是所有分类 先归为未分类 + this.form.path = 'none' } + val.forEach(element => { // 再遍历对比 所有分类 看默认分类是否存在 存在则改成对应分类 + if (element.path === this.defaultPath) { + this.form.path = this.defaultPath + } + }) this.updatePath() }, shop_id () { // 商铺selection改变时 分类selection如果不是"全部分类" 则改成"未分类" @@ -91,9 +96,14 @@ export default { }, created () { if (this.categoryList.length > 0) { - if (this.defaultPath !== '') { - this.form.path = this.defaultPath + if (this.defaultPath !== '') { // 首先 默认不是所有分类 先归为未分类 + this.form.path = 'none' } + this.categoryList.forEach(element => { // 再遍历对比 所有分类 看默认分类是否存在 存在则改成对应分类 + if (element.path === this.defaultPath) { + this.form.path = this.defaultPath + } + }) this.updatePath() } }, diff --git a/src/components/skuTransfer.vue b/src/components/skuTransfer.vue index 5d24713..4a9bf3c 100644 --- a/src/components/skuTransfer.vue +++ b/src/components/skuTransfer.vue @@ -1,6 +1,6 @@