vue-vben-admin/src/layouts/default/header/notice/NoticeList.vue

91 lines
2.0 KiB
Vue
Raw Normal View History

2020-10-21 21:15:06 +08:00
<template>
2020-11-23 23:24:13 +08:00
<a-list class="list">
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>
<div class="description">{{ item.description }}</div>
<div class="datetime">{{ item.datetime }}</div>
</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';
export default defineComponent({
props: {
list: {
2020-11-26 21:19:39 +08:00
type: Array as PropType<ListItem[]>,
2020-10-21 21:15:06 +08:00
default: () => [],
},
},
});
</script>
<style lang="less" scoped>
.list {
&::-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>