Blame view

src/layouts/default/header/notice/NoticeActionItem.vue 1.69 KB
chen-xt authored
1
<template>
2
  <div class="layout-header__action-item notify-action">
vben authored
3
    <Popover title="" trigger="click" overlayClassName="layout-header__notify-action">
4
      <Badge :count="count" dot :numberStyle="numberStyle">
chen-xt authored
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
        <BellOutlined class="layout-header__action-icon" />
      </Badge>
      <template #content>
        <Tabs>
          <template v-for="item in tabListData" :key="item.key">
            <TabPane>
              <template #tab>
                {{ item.name }}
                <span v-if="item.list.length !== 0">({{ item.list.length }})</span>
              </template>
              <NoticeList :list="item.list" />
            </TabPane>
          </template>
        </Tabs>
      </template>
    </Popover>
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  import { Popover, Tabs, Badge } from 'ant-design-vue';
  import { BellOutlined } from '@ant-design/icons-vue';
  import { tabListData } from './data';
  import NoticeList from './NoticeList.vue';

  export default defineComponent({
    components: { Popover, BellOutlined, Tabs, TabPane: Tabs.TabPane, Badge, NoticeList },
    setup() {
      let count = 0;
vben authored
34
chen-xt authored
35
36
37
38
39
40
41
42
43
44
45
46
      for (let i = 0; i < tabListData.length; i++) {
        count += tabListData[i].list.length;
      }

      return {
        tabListData,
        count,
        numberStyle: {},
      };
    },
  });
</script>
47
<style lang="less">
vben authored
48
49
50
51
  .layout-header__notify-action {
    max-width: 360px;
  }
52
53
  .notify-action {
    padding-top: 2px;
chen-xt authored
54
55
56
57
    .ant-tabs-content {
      width: 300px;
    }
chen-xt authored
58
59
60
    .ant-badge {
      font-size: 18px;
chen-xt authored
61
62
63
64
65
66
67
68
      .ant-badge-multiple-words {
        padding: 0 4px;
      }

      svg {
        width: 0.9em;
      }
chen-xt authored
69
70
71
    }
  }
</style>