Blame view

src/views/dashboard/analysis/components/SiteAnalysis.vue 996 Bytes
Vben authored
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
<template>
  <Card
    :tab-list="tabListTitle"
    v-bind="$attrs"
    :active-tab-key="activeKey"
    @tabChange="onTabChange"
  >
    <p v-if="activeKey === 'tab1'">
      <VisitAnalysis />
    </p>
    <p v-if="activeKey === 'tab2'">
      <VisitAnalysisBar />
    </p>
  </Card>
</template>
<script lang="ts">
  import { defineComponent, ref } from 'vue';

  import { Card } from 'ant-design-vue';

  import VisitAnalysis from './VisitAnalysis.vue';
  import VisitAnalysisBar from './VisitAnalysisBar.vue';

  export default defineComponent({
    components: { Card, VisitAnalysis, VisitAnalysisBar },
    setup() {
      const activeKey = ref('tab1');

      const tabListTitle = [
        {
          key: 'tab1',
          tab: '流量趋势',
        },
        {
          key: 'tab2',
          tab: '访问量',
        },
      ];

      function onTabChange(key) {
        activeKey.value = key;
      }
      return { tabListTitle, activeKey, onTabChange };
    },
  });
</script>