-
Notifications
You must be signed in to change notification settings - Fork 39
feat(empty): update empty #441
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
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LGTM |
HaydenOrz
requested changes
Feb 22, 2024
HaydenOrz
reviewed
Feb 23, 2024
HaydenOrz
approved these changes
Feb 23, 2024
liuxy0551
approved these changes
Aug 23, 2024
我看最后一个 commit 是把 |
改了,在 check 一下吧 |
liuxy0551
approved these changes
Sep 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#439
更新 Empty 组件
default | large
两个值,分别对应 height: 80 和 height: 100imageStyle
来替代之前的想法(已废弃)
新增 Empty.Placeholder 组件
背景
在我们产品中,经常出现如下代码,经常使用三元运算符来判断展示什么内容
添加 Empty.Placeholder 来简化该操作
存在问题
在目前的组件下,我们可以通过 props 传递一下属性给到 Empty 组件。除了 show 和 children 属性是给到 Empty.PlaceHolder 组件使用的,其他的属性都是通过 ...reset 给 Empty 组件使用
当我们想要展示如上的 Empty 组件的时候,目前是无法达成的。
解决方案:
方案
直接扩展 Empty 组件,采用和 Spin 组件一样的思路,如果 spinning 为 true 展示 loading,否则展示 children
传入 empty 属性,为 false 展示 children,否则展示 Empty 组件
上述废弃方案中提到 antd 的 empty 中的 children,通过 extra 来重写