question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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@3paragraph@2 ,它们将生成 3 article skeletons and 2 paragraph 骨架。具体的预设列表会根据后续具体业务场景来建立。
types 将与预定义选项结合使用的自定义类型对象。 有关可用的预定义选项的列表 object {} - type搭配使用,建立自定义的骨架模板。
名称 说明
default 默认插槽,放置骨架屏子组件

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ssccchhcommented, Feb 15, 2021

最终方案:

  1. 采用搭积木的方式,单元组件提供上述 apitypes 外的全部功能。
  2. types额外提供预设模板的功能放到pro中实现。
  3. types采用配置项形式注入模板。

DEMO

<ix-skeleton type="card"></ix-skeleton>
<ix-skeleton-pro type="custom" types="{custom: [name: 'card', length: 2']}"></ix-skeleton-pro>

Type SkeletonType = 'card' | 'avator' | 'list-item';

Interface Types {
  [key: string]: {name: SkeletonType, length: number}[];
}
0reactions
ssccchhcommented, Aug 2, 2021

重新设计Skeleton组件,这个issue关闭

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found