[comp: Skeleton] add Skeleton component
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
在需要等待加载内容的位置提供一个占位图形组合。
- 适用于图文列表信息比较多的场景
- 可以被 Spin 完全代替,但是在可用的场景下可以比 Spin 提供更好的视觉效果和用户体验。
- 提供预设模板,自由组合
What does the proposed API look like?
API
Ix-skeleton
Props
名称 | 说明 | 类型 | 默认值 | 全局配置 | 备注 |
---|---|---|---|---|---|
animation |
是否展示动画效果 | boolean |
false |
- | - |
width |
设置组件宽度 | number | string |
100% |
- | - |
height |
设置组件高度 | number | string |
100% |
- | - |
loading |
是否开启占位图 | boolean |
false |
- | false 的值只有在 default 槽中有内容时才会工作。 |
type |
字符串分隔要创建的骨架组件列表 | string |
undefined |
- | required 骨架组件列表,例如 type="text@3" 和 type="card , list-item "。将根据提供的字符串递归生成相应的框架。 还支持多个元素的简写,例如 article@3 和 paragraph@2 ,它们将生成 3 article skeletons and 2 paragraph 骨架。具体的预设列表会根据后续具体业务场景来建立。 |
types |
将与预定义选项结合使用的自定义类型对象。 有关可用的预定义选项的列表 | object |
{} |
- | 与type 搭配使用,建立自定义的骨架模板。 |
名称 | 说明 |
---|---|
default |
默认插槽,放置骨架屏子组件 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
React Skeleton Screen Tutorial #3 - Base Skeleton Component
In this React Skelton tutorial we'll create the base skeleton component that will provide the building blocks of our skeleton layouts.
Read more >How to Add Skeleton Screens in Next.js - MakeUseOf
Method 2: Using a Library Like 'React-Loading-Skeleton' ... Another way to implement skeleton screens is to use a library like react-loading- ...
Read more >How to build a skeleton screen with CSS and React
The first thing is to import the skeleton component at the top, and the next is to find where and how to add...
Read more >Implementing Skeleton Screen In React With React Loading ...
A skeleton screen is an UI that looks similar to the original structure of a page when all of its content is loaded....
Read more >3 Ways to Implement Skeleton Components in React
When a screen or webpage is loading, skeleton components are the placeholder elements that the user sees before the actual content is loaded....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
最终方案:
api
除types
外的全部功能。types
额外提供预设模板的功能放到pro
中实现。types
采用配置项形式注入模板。DEMO
重新设计Skeleton组件,这个issue关闭