Commit 427af309 by 前端

车主优选代码修改tab值

1 parent 2206d744
<template>
<div class="category-list-ctnr">
<GLTabs ref='GLTabs' class="tabs" v-model="activeName" :tabPaneList="tabPaneList"
<GLTabs ref='GLTabs' class="tabs" v-model="activeName" :tabPaneList="tabPaneList"
@tab-click="handleClick" removeTab="removeTab"></GLTabs>
<template v-if="activeName =='1'">
......@@ -55,7 +55,7 @@ export default {
},
data() {
return {
activeName: '',
activeName: '1',
curMainCategoryId: '',
tabPaneList: [],
mainCategoryList: [],
......@@ -140,7 +140,14 @@ export default {
},
created() {
this.getChannelList()
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (from.path.indexOf('/category/ownerPreference/add') == 0) {
vm.activeName = '2'
}
})
},
watch: {
curMainCategoryId: {
......@@ -151,23 +158,18 @@ export default {
},
activeName: {
handler(val) {
if (val ==1){
if (val == '1') {
this.getMainCategory()
}
},
immediate: true,
deep: true
},
},
mounted() {
},
methods: {
handleClick(tab, event) {
sessionStorage.setItem('tagActive', this.activeName)
},
//获取频道名称
getChannelList() {
this.$apis.channel
......@@ -182,7 +184,7 @@ export default {
if (item.channelType == 5 || item.channelType == 6) {
tabPaneList.push({
label: item.channelName,
name: item.channelType == 5 ? 1 : 2,
name: item.channelType == 5 ? '1' : '2',
merchantChannelId: item.id
})
}
......@@ -190,9 +192,9 @@ export default {
this.tabPaneList = tabPaneList
// 处理返回的tab值
let tagName = sessionStorage.getItem('tagActive')
this.activeName = tagName * 1 || tabPaneList[0].name
// this.activeName = tabPaneList[0].name
// let tagName = sessionStorage.getItem('tagActive')
// this.activeName = tagName '' || tabPaneList[0].name
// this.activeName = _name
}
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!