index.vue
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<div class="container">
<GLTabs class="tab" v-model="tabId" :tabPaneList="tabPaneList"></GLTabs>
<template v-if="tabId == '2'">
<goodIndex></goodIndex>
</template>
<template v-if="tabId == '1'">
<prodIndex></prodIndex>
</template>
<template v-if="tabId == '3'">
<parentIndex></parentIndex>
</template>
</div>
</template>
<script>
import goodIndex from './goodIndex.vue'
import prodIndex from './prodIndex.vue'
import parentIndex from './parentIndex.vue'
export default {
name: 'index',
components: {
goodIndex,
prodIndex,
parentIndex
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (from.path.indexOf('/ContractManager/addTmpl') == 0 && from.path.indexOf('skuId') == -1) {
vm.tabId = '2'
}
if ((from.path.indexOf('/ContractManager/addTmpl') == 0 && from.path.indexOf('skuId') == -1 && from.path.indexOf('isParent') > -1) || from.path.indexOf('/ContractManager/parentDetail') == 0) {
vm.tabId = '3'
}
})
},
data() {
return {
tabId: '1',
tabPaneList: [
{ name: '1', label: '产品合同' },
{ name: '2', label: '商品合同' },
{ name: '3', label: '套餐合同' }
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.tab {
margin-bottom: 16px;
}
</style>