Ant-design: TypeError:当值为null的渲染Button时,无法读取null的属性“ type”。

创建于 2017-03-24  ·  4评论  ·  资料来源: ant-design/ant-design

环境(必填)

  • antd版本:2.8.2
  • 操作系统及其版本:macOS 10.11.6
  • 浏览器及其版本:Chrome 57

你做了什么? 请提供步骤以重现您的问题。

<Button>{null}🙃</Button>

您期望什么?

正确呈现按钮( <button>🙃</button> )。

发生什么事?

insertSpace方法执行快递null.type
导致类型错误:

Uncaught TypeError: Cannot read property 'type' of null
    at insertSpace (unpkg.com/[email protected]/dist/antd-with-locales.js:88201)
    at mapSingleChildIntoContext (unpkg.com/[email protected]/dist/react.js:371)
    at traverseAllChildrenImpl (unpkg.com/[email protected]/dist/react.js:3390)
    at traverseAllChildrenImpl (unpkg.com/[email protected]/dist/react.js:3406)
    at traverseAllChildren (unpkg.com/[email protected]/dist/react.js:3485)
    at mapIntoWithKeyPrefixInternal (unpkg.com/[email protected]/dist/react.js:391)
    at Object.mapChildren [as map] (unpkg.com/[email protected]/dist/react.js:413)
    at Button.render (unpkg.com/[email protected]/dist/antd-with-locales.js:88303)
    at unpkg.com/[email protected]/dist/react-dom.js:5250
    at measureLifeCyclePerf (unpkg.com/[email protected]/dist/react-dom.js:4529)

可复制的在线演示

http://codepen.io/blade254353074/pen/wJXgrL

help wanted 🐛 Bug

最有用的评论

@ afc163完成。

所有4条评论

🙃

您能帮我们解决这个问题吗?

是的,请稍等。

@ afc163完成。

该线程没有最近的活动,因此已被自动锁定。 请针对相关错误打开新一期,并链接到该主题中的相关注释。

此页面是否有帮助?
0 / 5 - 0 等级