Ant-design: 引入Popconfirm 报 'className' of undefined错误

Created on 19 Nov 2016  ·  7Comments  ·  Source: ant-design/ant-design

发生问题的环境是:

  • antd 版本:2.4.3
  • 操作系统及其版本:win
  • 浏览器及其版本: Google Chrome版本 54.0.2840.99 m

您做了什么?请提供尽可能详细的重现步骤。

引入antd 的 Popconfirm

报错 Uncaught TypeError: Cannot read property 'className' of undefined

如果不用这个组件 代码正常

代码如下

const columns = [
{title: '昵称', dataIndex: 'nickName', key: 'nickName'},
{title: '登录名', dataIndex: 'loginName', key: 'loginName'},
{title: '姓名', dataIndex: 'name', key: 'name', render: (text)=>{text}},
{title: '操作', dataIndex: '', key: 'operation', render: (text)=>(


编辑
onConfirm={()=>Message.success("点击了确认删除")}
okText="Yes"
cancelText="No"

删除


)}
];

help wanted

Most helpful comment

感觉可以做一层适配,如果 children 不是 ReactElement,就自动包上 span 标签。

All 7 comments

<Popconfirm>
-  删除
+  <span>删除</span>
</Popconfirm>

Please read documentation & FAQ and search issues before open an issue, THX!

It will be better if you read smart questions(提问的智慧).

感觉可以做一层适配,如果 children 不是 ReactElement,就自动包上 span 标签。

在 antd 这一层做适配即可。

Similar issue with Dropdown I think

Similar issue with Dropdown I think

Was this page helpful?
0 / 5 - 0 ratings