Vben
authored
|
1
2
3
4
5
|
<template>
<Card
:tab-list="tabListTitle"
v-bind="$attrs"
:active-tab-key="activeKey"
|
vben
authored
|
6
|
@tab-change="onTabChange"
|
Vben
authored
|
7
8
9
10
11
12
13
14
15
|
>
<p v-if="activeKey === 'tab1'">
<VisitAnalysis />
</p>
<p v-if="activeKey === 'tab2'">
<VisitAnalysisBar />
</p>
</Card>
</template>
|
vben
authored
|
16
17
|
<script lang="ts" setup>
import { ref } from 'vue';
|
Vben
authored
|
18
19
20
21
|
import { Card } from 'ant-design-vue';
import VisitAnalysis from './VisitAnalysis.vue';
import VisitAnalysisBar from './VisitAnalysisBar.vue';
|
vben
authored
|
22
|
const activeKey = ref('tab1');
|
Vben
authored
|
23
|
|
vben
authored
|
24
25
26
27
|
const tabListTitle = [
{
key: 'tab1',
tab: '流量趋势',
|
Vben
authored
|
28
|
},
|
vben
authored
|
29
30
31
32
33
34
35
36
37
|
{
key: 'tab2',
tab: '访问量',
},
];
function onTabChange(key) {
activeKey.value = key;
}
|
Vben
authored
|
38
|
</script>
|