vue-vben-admin/src/layouts/default/header/components/notify/NoticeList.vue

109 lines
2.5 KiB
Vue
Raw Normal View History

2020-10-21 21:15:06 +08:00
<template>
2020-12-15 00:13:23 +08:00
<a-list :class="prefixCls">
2020-10-21 21:15:06 +08:00
<template v-for="item in list" :key="item.id">
2020-11-23 23:24:13 +08:00
<a-list-item class="list-item">
<a-list-item-meta>
2020-10-21 21:15:06 +08:00
<template #title>
<div class="title">
{{ item.title }}
<div class="extra" v-if="item.extra">
2020-11-23 23:24:13 +08:00
<a-tag class="tag" :color="item.color">
2020-10-21 21:15:06 +08:00
{{ item.extra }}
2020-11-23 23:24:13 +08:00
</a-tag>
2020-10-21 21:15:06 +08:00
</div>
</div>
</template>
2020-11-23 23:24:13 +08:00
2020-10-21 21:15:06 +08:00
<template #avatar>
2020-11-23 23:24:13 +08:00
<a-avatar v-if="item.avatar" class="avatar" :src="item.avatar" />
2020-10-21 21:15:06 +08:00
<span v-else> {{ item.avatar }}</span>
</template>
2020-11-23 23:24:13 +08:00
2020-10-21 21:15:06 +08:00
<template #description>
<div>
2021-01-28 23:28:50 +08:00
<div class="description">
{{ item.description }}
</div>
<div class="datetime">
{{ item.datetime }}
</div>
2020-10-21 21:15:06 +08:00
</div>
</template>
2020-11-23 23:24:13 +08:00
</a-list-item-meta>
</a-list-item>
2020-10-21 21:15:06 +08:00
</template>
2020-11-23 23:24:13 +08:00
</a-list>
2020-10-21 21:15:06 +08:00
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue';
import { ListItem } from './data';
2020-12-15 00:13:23 +08:00
import { useDesign } from '/@/hooks/web/useDesign';
2021-01-18 23:37:36 +08:00
import { List, Avatar, Tag } from 'ant-design-vue';
2020-10-21 21:15:06 +08:00
export default defineComponent({
2021-01-18 23:37:36 +08:00
components: {
[Avatar.name]: Avatar,
[List.name]: List,
[List.Item.name]: List.Item,
AListItemMeta: List.Item.Meta,
[Tag.name]: Tag,
},
2020-10-21 21:15:06 +08:00
props: {
list: {
2020-11-26 21:19:39 +08:00
type: Array as PropType<ListItem[]>,
2020-10-21 21:15:06 +08:00
default: () => [],
},
},
2020-12-15 00:13:23 +08:00
setup() {
const { prefixCls } = useDesign('header-notify-list');
return { prefixCls };
},
2020-10-21 21:15:06 +08:00
});
</script>
<style lang="less" scoped>
2020-12-15 00:13:23 +08:00
@prefix-cls: ~'@{namespace}-header-notify-list';
.@{prefix-cls} {
2020-10-21 21:15:06 +08:00
&::-webkit-scrollbar {
display: none;
}
2020-11-23 23:24:13 +08:00
&-item {
2020-10-21 21:15:06 +08:00
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>