Commit 427af309 by 前端

车主优选代码修改tab值

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