@@ -235,7 +235,7 @@ export default {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
} catch (e) {
}
- if (this.secondId == id) {
+ if (this.secondId == id && this.navList) {
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
@@ -253,6 +253,7 @@ export default {
this.secondId = this.$route.params && this.$route.params.secondId;
this.navId = this.$route.params && this.$route.params.navId;
this.type = this.$route.query && this.$route.query.type
+ console.log(this.type,"this.type")
setTimeout(() => {
this.getNav()
}, 200);
@@ -310,34 +311,60 @@ export default {
/**
* 获得节点信息
*/
- getNodes() {
+ async getNodes() {
this.navList = []
- getNode({id: this.secondId}).then(res => {
- this.navList = res.data
- try {
- setTimeout(() => {
- this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
- }, 100);
- } catch (e) {
- console.log(e)
+ // await getNode({id: this.secondId}).then(res => {
+ // this.navList = res.data
+ // try {
+ // setTimeout(() => {
+ // this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
+ // }, 100);
+ // } catch (e) {
+ // console.log(e)
+ // }
+ // // if (!this.navList){
+ // // return
+ // // }
+ // for (let i = 0; i < this.navList.length; i++) {
+ // if (this.navId == this.navList[i].encodeId) {
+ // this.showIndex = i
+ // }
+ // }
+ // let arcId = this.$route.query && this.$route.query.id
+ // if (arcId != undefined) {
+ // this.getContext(arcId)
+ // } else {
+ // console.log("测试,我被触发了!")
+ // if (this.navId == undefined) {
+ // this.getContent(this.navList[0])
+ // } else {
+ // this.getContent(this.navList[this.showIndex])
+ // }
+ // }
+ // })
+ let res = await getNode({id: this.secondId})
+ // todo 延时异步问题
+ this.$refs.lab.style.height = res.data.length * 8 + 10 + 'rem'
+ this.navList = res.data
+ // if (!this.navList){
+ // return
+ // }
+ for (let i = 0; i < this.navList.length; i++) {
+ if (this.navId == this.navList[i].encodeId) {
+ this.showIndex = i
}
- for (let i = 0; i < this.navList.length; i++) {
- if (this.navId == this.navList[i].encodeId) {
- this.showIndex = i
- }
- }
- let arcId = this.$route.query && this.$route.query.id
- if (arcId != undefined) {
- this.getContext(arcId)
+ }
+ let arcId = this.$route.query && this.$route.query.id
+ if (arcId != undefined) {
+ this.getContext(arcId)
+ } else {
+ console.log("测试,我被触发了!")
+ if (this.navId == undefined) {
+ this.getContent(this.navList[0])
} else {
- console.log("测试,我被触发了!")
- if (this.navId == undefined) {
- this.getContent(this.navList[0])
- } else {
- this.getContent(this.navList[this.showIndex])
- }
+ this.getContent(this.navList[this.showIndex])
}
- })
+ }
},
/**
* 获取三级菜单
@@ -345,6 +372,10 @@ export default {
*/
getContent(menu) {
console.log("getContent内部,menu:", menu)
+ console.log(menu)
+ if (menu == undefined){
+ return
+ }
this.type = menu.type
this.contextData = null
this.bgImage = menu.link
diff --git a/src/views/mobile/index.vue b/src/views/mobile/index.vue
index 6ff8af4..385919f 100644
--- a/src/views/mobile/index.vue
+++ b/src/views/mobile/index.vue
@@ -110,6 +110,7 @@ export default {
this.getContext(arcId)
} else {
this.menuData = getParentNode(this.navId)
+ console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
}
@@ -125,6 +126,7 @@ export default {
},
methods: {
init(){
+ console.log(this.navId)
this.menuData = getParentNode(this.navId)
crumbs(this.secondId).then(res => {
this.crumbs = res.data
@@ -148,6 +150,7 @@ export default {
if (arcId != undefined) {
this.getContext(arcId)
} else {
+ console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
},
@@ -161,7 +164,7 @@ export default {
},
getContent(menu) {
console.log(menu)
- //let menu = this.menuData.three
+ // let menu = this.menuData.three
this.type = menu.type
this.contextData = null
this.bgImage = menu.link