-
-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If <Table /> is hidden, don't recalculate rowHeight. #122
Conversation
src/Table.jsx
Outdated
const tableRect = this.tableNode.getBoundingClientRect(); | ||
// If tableNode's height less than 0, suppose it is hidden and don't recalculate rowHeight. | ||
// see: https://github.com/ant-design/ant-design/issues/4836 | ||
if (tableRect.height <= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有没可能 tableRect 或 tableRect.height 是 undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有可能,IE8或更低浏览器里返回的 rect 没有 width 和 height 属性。如果要兼容 IE8- 的话,将获取高度的方式改为rect.bottom - rect.top
应该可行。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tableRect.height && tableRect <= 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
条件判断是不是应该这样?tableRect.height !== undefined && tableRect.height <= 0
@afc163 求教
|
CI 我调整了, rebase 下 master 吧。 |
@ystarlongzi jsdom 获取 DOM 元素宽高的问题,可以这样 mock https://github.com/react-component/slider/blob/master/tests/common/createSlider.test.js#L90 |
src/Table.jsx
Outdated
@@ -587,6 +587,12 @@ const Table = React.createClass({ | |||
}, | |||
|
|||
syncFixedTableRowHeight() { | |||
const tableRect = this.tableNode.getBoundingClientRect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
单测里面 tableNode.getBoundingClientRect === mock function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,我试下,谢谢
这个测试失败怎么解决呢?Table.jsx#L639 处的 this 变成 undefined 了? 但是本地运行 本地环境如下:
|
再 rebase 下吧。 |
@yesmeck 不是很明白, |
我把 |
哦哦,谢谢
发自网易邮箱大师
在2017年02月16日 20:55,Wei Zhu 写道:
我把 React.createClass 改成 ES6 class 了,自动绑定没有了。
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
发个 patch ? |
@ @ 等我周末再补点测试 |
这么晚还在.. |
Released 5.2.10 |
fix ant-design #4836
然后在写测试时发现使用
enzyme
渲染组件,无法获取元素的宽高,所以就没补上测试。