Blame view

src/layouts/default/header/components/notify/NoticeList.vue 2.23 KB
chen-xt authored
1
<template>
vben authored
2
  <a-list :class="prefixCls">
chen-xt authored
3
    <template v-for="item in list" :key="item.id">
vben authored
4
5
      <a-list-item class="list-item">
        <a-list-item-meta>
chen-xt authored
6
7
8
9
          <template #title>
            <div class="title">
              {{ item.title }}
              <div class="extra" v-if="item.extra">
vben authored
10
                <a-tag class="tag" :color="item.color">
chen-xt authored
11
                  {{ item.extra }}
vben authored
12
                </a-tag>
chen-xt authored
13
14
15
              </div>
            </div>
          </template>
vben authored
16
chen-xt authored
17
          <template #avatar>
vben authored
18
            <a-avatar v-if="item.avatar" class="avatar" :src="item.avatar" />
chen-xt authored
19
20
            <span v-else> {{ item.avatar }}</span>
          </template>
vben authored
21
chen-xt authored
22
23
24
25
26
27
          <template #description>
            <div>
              <div class="description">{{ item.description }}</div>
              <div class="datetime">{{ item.datetime }}</div>
            </div>
          </template>
vben authored
28
29
        </a-list-item-meta>
      </a-list-item>
chen-xt authored
30
    </template>
vben authored
31
  </a-list>
chen-xt authored
32
33
34
35
</template>
<script lang="ts">
  import { defineComponent, PropType } from 'vue';
  import { ListItem } from './data';
vben authored
36
  import { useDesign } from '/@/hooks/web/useDesign';
chen-xt authored
37
38
39
40

  export default defineComponent({
    props: {
      list: {
vben authored
41
        type: Array as PropType<ListItem[]>,
chen-xt authored
42
43
44
        default: () => [],
      },
    },
vben authored
45
46
47
48
    setup() {
      const { prefixCls } = useDesign('header-notify-list');
      return { prefixCls };
    },
chen-xt authored
49
50
51
  });
</script>
<style lang="less" scoped>
vben authored
52
53
54
55
  @import (reference) '../../../../../design/index.less';
  @prefix-cls: ~'@{namespace}-header-notify-list';

  .@{prefix-cls} {
chen-xt authored
56
57
58
59
    &::-webkit-scrollbar {
      display: none;
    }
vben authored
60
    &-item {
chen-xt authored
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
      padding: 6px;
      overflow: hidden;
      cursor: pointer;
      transition: all 0.3s;

      .title {
        margin-bottom: 8px;
        font-weight: normal;

        .extra {
          float: right;
          margin-top: -1.5px;
          margin-right: 0;
          font-weight: normal;

          .tag {
            margin-right: 0;
          }
        }

        .avatar {
          margin-top: 4px;
        }

        .description {
          font-size: 12px;
          line-height: 18px;
        }

        .datetime {
          margin-top: 4px;
          font-size: 12px;
          line-height: 18px;
        }
      }
    }
  }
</style>