import './index.less'
import { Badge, Popover, Icon, Spin, Tabs } from "ant-design-vue";
import classNames from "classnames";
import List from './NoticeList';
const { TabPane } = Tabs
const NoticeIcon = {
props: ["className", "count", "bell", "locale", "loading"],
methods: {
classNames,
onClear(e) {
// console.log(e);
this.$emit('clear',e);
},
onTabChange(e) {
this.$emit('tabChange', e);
},
onPopupVisibleChange(e) {
this.$emit('popupVisibleChange', e);
},
onItemClick(item, tabProps) {
console.log(item);
this.$emit('itemClick', item, tabProps);
},
getNotificationBox() {
const { $slots, locale = {
emptyText: '暂无数据',
clear: '清空',
}, loading = false } = this;
const children = $slots.default;
if (!children) {
return null;
}
const panes = children.map(child => {
const { list, title, emptyText, emptyImage = 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg' } = child.data.attrs
const tab = list && list.length > 0 ? `${title} (${list.length})` : title
return (
this.onItemClick(item, child.data.attrs)}
onClear={() => this.onClear(title)}
title={title}
locale={locale}
emptyText={emptyText}
emptyImage={emptyImage}
/>
)
})
return (
{panes}
)
}
},
render() {
const { className, bell, count, onPopupVisibleChange } = this
const noticeButtonClass = classNames(className, 'noticeButton');
const NoticeBellIcon = bell || ;
const trigger = (
{NoticeBellIcon}
);
const notificationBox = this.getNotificationBox();
if (!notificationBox) {
return trigger;
}
return (
{trigger}
)
}
}
NoticeIcon.Tab = TabPane
export default NoticeIcon