Skip to content
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

fix(Tab): should not be obscured if has extra #4839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GCHHCG
Copy link
Collaborator

@GCHHCG GCHHCG commented May 8, 2024

close #4808

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是您为 Fusion/Next 提的第一个 pr,感谢您为 Fusion 做出的贡献,我们会尽快进行处理。

@@ -580,7 +580,19 @@ class Nav extends React.Component {
[`${prefix}tabs-nav-wrap`]: true,
[`${prefix}tabs-nav-has-add`]: showAdd,
});

// let extraStyle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

无用的代码请删除

// marginRight: window.getComputedStyle(this.navbar?.childNodes[0]).width
// }
// }
if(this.navbar && this.navbar.childNodes.length===2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外代码可以格式化一下,目前有些该空格的地方没有空格

// }
// }
if(this.navbar && this.navbar.childNodes.length===2) {
this.navbar.childNodes[1].style.setProperty('--extra-width', window.getComputedStyle(this.navbar.childNodes[0]).width);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render 在 react 中的调用频次是很频繁的,而且render 中不一定重新渲染还没有完成。一般不会在 render 函数中引入 side effect,而是在类似 componentDidMount 等 lifeCycle 中完成。

@@ -5,6 +5,10 @@
@import "./scss/mixin";
@import "./scss/placeholder";

:root {
--extra-width: 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css 变量还是有一些兼容性问题的,我们目前代码内部没有完全依赖 css 变量的地方。这里其实不使用 css 变量也可以实现。可以参考其他组件,直接操作 dom style 来实现

@GCHHCG GCHHCG force-pushed the fix-issue-4808 branch 4 times, most recently from b148396 to 2155f04 Compare June 6, 2024 06:06
@@ -66,6 +66,9 @@ class Nav extends React.Component {
this.initialSettings();
}

if (this.navbar && this.navbar.childNodes.length === 2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉只在 didMount 里处理一次是不够的,有可能组件 update 之后情况会发生变化。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tab]tab组件内容被遮挡
2 participants