allot.vue
1.43 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
59
60
61
62
<template>
<LayoutBody>
<LayoutTab>
<Tabs :value="activate" animated="false" @on-click="switchTab">
<Tab-pane :label="tab1.label" :name="tab1.name"></Tab-pane>
<Tab-pane :label="tab2.label" :name="tab2.name"></Tab-pane>
<Tab-pane :label="tab3.label" :name="tab3.name"></Tab-pane>
</Tabs>
<router-view></router-view>
</LayoutTab>
</LayoutBody>
</template>
<script>
export default {
data() {
return {
tab1: {
label: '发货未完成',
name: 'undone'
},
tab2: {
label: '发货已完成',
name: 'done'
},
tab3: {
label: '发货物流表',
name: 'express'
},
activate: ''
};
},
created() {
const path = this.$route.path;
const children = ['undone', 'done', 'express'];
_.each(children, v => {
const reg = new RegExp(`/${v}`);
console.log(reg.test(path))
if(reg.test(path)) {
this.activate = v;
return false;
}
});
},
methods: {
switchTab(name) {
this.$router.push({
name: `trade.allot.${name}`
});
}
},
components: {}
};
</script>
<style lang="scss" scoped>
</style>