import { defineComponent } from 'vue'; import { List, Avatar, Tag } from 'ant-design-vue'; import { NoticeListItem } from './data'; import './index.less'; const prefixCls = 'notice-popover'; export default defineComponent({ name: 'NoticeList', props: { list: { type: Array, default: () => [], }, }, setup(props) { // 头像渲染 function renderAvatar(avatar: string) { return avatar ? : {avatar}; } // 描述渲染 function renderDescription(description: string, datetime: string) { return (
{description}
{datetime}
); } // 标题渲染 function renderTitle(title: string, extra?: string, color?: string) { return (
{title} {extra && (
{() => extra}
)}
); } return () => { const { list } = props; return ( {() => { return list.map((item: NoticeListItem) => { const { id, avatar, title, description, datetime, extra, read, color } = item; return ( {() => ( )} ); }); }} ); }; }, });