|
8 | 8 |
|
9 | 9 | # StatusTag 状态标签 |
10 | 10 |
|
| 11 | +通过不同颜色的圆形图标区分状态 |
| 12 | + |
11 | 13 | ## 何时使用 |
12 | 14 |
|
13 | 15 | StatusTag 组件作用于任务运行状态效果展示 |
14 | 16 |
|
15 | 17 | ## 示例 |
16 | 18 |
|
17 | | -```jsx |
18 | | -/** |
19 | | - * title: "基础使用" |
20 | | - */ |
21 | | -import React from 'react'; |
22 | | -import { StatusTag } from 'dt-react-component'; |
23 | | - |
24 | | -export default () => { |
25 | | - return ( |
26 | | - <> |
27 | | - <StatusTag type="run">运行中</StatusTag> |
28 | | - <StatusTag type="success">成功</StatusTag> |
29 | | - <StatusTag type="stopped">取消</StatusTag> |
30 | | - <StatusTag type="error">运行失败</StatusTag> |
31 | | - <StatusTag type="warning">提交中</StatusTag> |
32 | | - </> |
33 | | - ); |
34 | | -}; |
35 | | -``` |
36 | | - |
37 | | -```jsx |
38 | | -/** |
39 | | - * title: "取消外边框" |
40 | | - */ |
41 | | -import React from 'react'; |
42 | | -import { StatusTag } from 'dt-react-component'; |
43 | | - |
44 | | -export default () => { |
45 | | - return ( |
46 | | - <> |
47 | | - <StatusTag type="run" showBorder={false}> |
48 | | - 运行中 |
49 | | - </StatusTag> |
50 | | - <StatusTag type="error" showBorder={false}> |
51 | | - 运行失败 |
52 | | - </StatusTag> |
53 | | - <StatusTag type="success" showBorder={false}> |
54 | | - 成功 |
55 | | - </StatusTag> |
56 | | - <StatusTag type="stopped" showBorder={false}> |
57 | | - 取消 |
58 | | - </StatusTag> |
59 | | - <StatusTag type="warning" showBorder={false}> |
60 | | - 等待提交 |
61 | | - </StatusTag> |
62 | | - </> |
63 | | - ); |
64 | | -}; |
65 | | -``` |
66 | | - |
67 | | -```jsx |
68 | | -/** |
69 | | - * title: "自定义颜色" |
70 | | - */ |
71 | | -import React from 'react'; |
72 | | -import { StatusTag } from 'dt-react-component'; |
73 | | - |
74 | | -export default () => { |
75 | | - return ( |
76 | | - <> |
77 | | - <StatusTag type="run" color="#bc84a8"> |
78 | | - 运行中 |
79 | | - </StatusTag> |
80 | | - <StatusTag type="run" color="#2177b8" showBorder={false}> |
81 | | - 运行中 |
82 | | - </StatusTag> |
83 | | - </> |
84 | | - ); |
85 | | -}; |
86 | | -``` |
87 | | - |
88 | | -```jsx |
89 | | -/** |
90 | | - * title: "圆点" |
91 | | - */ |
92 | | -import React from 'react'; |
93 | | -import { StatusTag } from 'dt-react-component'; |
94 | | - |
95 | | -export default () => { |
96 | | - return ( |
97 | | - <> |
98 | | - <StatusTag type="run" showBorder={false} /> |
99 | | - <StatusTag color="#2177b8" showBorder={false} /> |
100 | | - </> |
101 | | - ); |
102 | | -}; |
103 | | -``` |
| 19 | +<code src="./demos/basic.tsx" description="内置五种不同的 `type` ">基础使用</code> |
| 20 | +<code src="./demos/status.tsx" description="用于表示状态的小圆点">状态点</code> |
| 21 | +<code src="./demos/colorful.tsx" description="我们添加了多种预设色彩的状态样式,用作不同场景使用。如果预设值不能满足你的需求,可以设置为具体的色值">自定义状态</code> |
| 22 | +<code src="./demos/border.tsx" description="通过设置 `showBorder={false}` 可以隐藏外边框,默认为存在外边框">外边框</code> |
104 | 23 |
|
105 | 24 | ## API |
106 | 25 |
|
| 26 | +### StatusTag |
| 27 | + |
107 | 28 | | 参数 | 说明 | 类型 | 默认值 | |
108 | 29 | | ---------- | -------------------------------------------------------- | --------------------------------------------------------- | ----------- | |
109 | 30 | | type | 设置状态类型 | `'warning' \| 'error' \| 'success' \| 'run' \| 'stopped'` | `'success'` | |
|
0 commit comments