popover.md 2.11 KB
Newer Older
1 2 3 4 5
---
order: 2
title: 带浮层卡片
---

afc163's avatar
afc163 committed
6
点击展开通知卡片,展现多种类型的通知,通常放在顶部通栏。
7 8

````jsx
nikogu's avatar
nikogu committed
9
import NoticeIcon from 'ant-design-pro/lib/NoticeIcon';
10
import moment from 'moment';
afc163's avatar
afc163 committed
11
import { Tag } from 'antd';
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

const data = [{
  key: '1',
  avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
  title: '曲丽丽 评论了你',
  description: '描述信息描述信息描述信息',
  datetime: moment('2017-08-07').fromNow(),
}, {
  key: '2',
  avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
  title: '朱偏右 回复了你',
  description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
  datetime: moment('2017-08-07').fromNow(),
}, {
  key: '3',
  avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
  title: '标题',
  description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
  datetime: moment('2017-08-07').fromNow(),
afc163's avatar
afc163 committed
31
  extra: <Tag color="red">标签</Tag>,
32 33
}];

afc163's avatar
afc163 committed
34 35 36 37 38 39 40 41
function onItemClick(item, tabProps) {
  console.log(item, tabProps);
}

function onClear(tabTitle) {
  console.log(tabTitle);
}

42
ReactDOM.render(
afc163's avatar
afc163 committed
43 44 45 46 47 48 49 50 51 52 53
  <div
    style={{
      textAlign: 'right',
      height: '64px',
      lineHeight: '64px',
      boxShadow: '0 1px 4px rgba(0,21,41,.12)',
      padding: '0 32px',
      width: '400px',
    }}
  >
    <NoticeIcon count={5} onItemClick={onItemClick} onClear={onClear}>
afc163's avatar
afc163 committed
54
      <NoticeIcon.Tab
nikogu's avatar
nikogu committed
55
        list={data}
afc163's avatar
afc163 committed
56 57
        title="通知"
        emptyText="你已查看所有通知"
afc163's avatar
afc163 committed
58
        emptyImage="https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg"
afc163's avatar
afc163 committed
59 60
      />
      <NoticeIcon.Tab
nikogu's avatar
nikogu committed
61
        list={data}
afc163's avatar
afc163 committed
62 63
        title="消息"
        emptyText="您已读完所有消息"
afc163's avatar
afc163 committed
64
        emptyImage="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
afc163's avatar
afc163 committed
65 66
      />
      <NoticeIcon.Tab
nikogu's avatar
nikogu committed
67
        list={data}
afc163's avatar
afc163 committed
68 69 70 71
        title="待办"
        emptyText="你已完成所有待办"
        emptyImage="https://gw.alipayobjects.com/zos/rmsportal/HsIsxMZiWKrNUavQUXqx.svg"
      />
72 73 74 75
    </NoticeIcon>
  </div>
, mountNode);
````