popover.md 1.65 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}>
54 55 56 57 58 59 60
      <NoticeIcon.Tab list={data} title="通知" />
      <NoticeIcon.Tab list={data} title="消息" />
      <NoticeIcon.Tab list={[]} title="待办" />
    </NoticeIcon>
  </div>
, mountNode);
````