提交 646d087a authored 作者: 郑伟娜's avatar 郑伟娜

修改添加商品报错

上级 9e3195b5
...@@ -88,12 +88,12 @@ ...@@ -88,12 +88,12 @@
export default { export default {
name: 'Index', name: 'Index',
props: { // props: {
option: { // option: {
type: Number, // type: Number,
required: true // required: true
} // }
}, // },
components: { components: {
Goodsinfomation, Goodsinfomation,
GoodsSpecifications, GoodsSpecifications,
...@@ -156,12 +156,14 @@ ...@@ -156,12 +156,14 @@
}, // 商品所有数据 }, // 商品所有数据
TIMER: null, TIMER: null,
hehe: 0, hehe: 0,
option: 0
} // return end } // return end
}, },
created() { created() {
// option 商品的id // option 商品的id
//debugger //debugger
this.option = Number(this.$route.query.goods_id)
if( this.option && this.option !== 0 ) { if( this.option && this.option !== 0 ) {
let data = { goodsId: this.option}; let data = { goodsId: this.option};
getGoodsNew(data).then(res => { getGoodsNew(data).then(res => {
...@@ -342,8 +344,8 @@ ...@@ -342,8 +344,8 @@
NewGetCategoryData(limboNode).then(res => { NewGetCategoryData(limboNode).then(res => {
let result = {}; let result = {};
if (level === 0) {
result = res.data result = res.data
if (level === 0) {
result.forEach(item => { result.forEach(item => {
item.value = item.id; item.value = item.id;
item.label = item.label; item.label = item.label;
...@@ -370,15 +372,11 @@ ...@@ -370,15 +372,11 @@
if (level === 2) { if (level === 2) {
for(let i = 0; i < res.data.length; i++) { for(let i = 0; i < res.data.length; i++) {
if( res.data[i].children.length > 0) { if( limboNode.id === res.data[i].id ) {
for(let j = 0; j < res.data[i].children.length; j++) { result = res.data[i].children;
if( limboNode.id === res.data[i].children[j].id ) {
result = res.data[i].children[j].children;
break; break;
} }
} }
}
}
result.forEach(item => { result.forEach(item => {
item.value = item.id; item.value = item.id;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论