index.vue
941 Bytes
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
<template>
<div class="container">
<GLTabs class="tab" v-model="tabId" :tabPaneList="tabPaneList"></GLTabs>
<template v-if="tabId == '1'">
<carDamage></carDamage>
</template>
<template v-if="tabId == '2'">
<extendedWarranty></extendedWarranty>
</template>
</div>
</template>
<script>
import carDamage from './carDamage.vue'
import extendedWarranty from './extendedWarranty.vue'
export default {
name: 'index',
components: {
carDamage,
extendedWarranty
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (from.path.indexOf('extendedFlag') > -1) {
vm.tabId = '2'
}
})
},
data() {
return {
tabId: '1',
tabPaneList: [
{ name: '1', label: '车损权益' },
{ name: '2', label: '延保权益' }
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.tab {
margin-bottom: 16px;
}
</style>