@mijadesign/nut-mcp 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +147 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +16 -0
  4. package/dist/services/aliases.service.d.ts +1 -0
  5. package/dist/services/aliases.service.js +19 -0
  6. package/dist/services/doc-parser.service.d.ts +3 -0
  7. package/dist/services/doc-parser.service.js +162 -0
  8. package/dist/services/index.services.d.ts +3 -0
  9. package/dist/services/index.services.js +71 -0
  10. package/dist/services/paths.service.d.ts +5 -0
  11. package/dist/services/paths.service.js +18 -0
  12. package/dist/tools/base.tool.d.ts +8 -0
  13. package/dist/tools/base.tool.js +27 -0
  14. package/dist/tools/get-component-doc.tool.d.ts +12 -0
  15. package/dist/tools/get-component-doc.tool.js +40 -0
  16. package/dist/tools/index.d.ts +4 -0
  17. package/dist/tools/index.js +4 -0
  18. package/dist/tools/list-components.tool.d.ts +8 -0
  19. package/dist/tools/list-components.tool.js +32 -0
  20. package/dist/tools/search-components.tool.d.ts +12 -0
  21. package/dist/tools/search-components.tool.js +61 -0
  22. package/dist/types/index.d.ts +33 -0
  23. package/dist/types/index.js +1 -0
  24. package/docs/docs/aliases.json +59 -0
  25. package/docs/docs/components/base/button/index.md +415 -0
  26. package/docs/docs/components/base/cell/index.md +279 -0
  27. package/docs/docs/components/base/configprovider/index.md +215 -0
  28. package/docs/docs/components/base/image/index.md +282 -0
  29. package/docs/docs/components/base/overlay/index.md +288 -0
  30. package/docs/docs/components/dentry/cascader/index.md +1080 -0
  31. package/docs/docs/components/dentry/checkbox/index.md +842 -0
  32. package/docs/docs/components/dentry/datepicker/index.md +489 -0
  33. package/docs/docs/components/dentry/form/index.md +457 -0
  34. package/docs/docs/components/dentry/input/index.md +257 -0
  35. package/docs/docs/components/dentry/picker/index.md +621 -0
  36. package/docs/docs/components/dentry/radio/index.md +364 -0
  37. package/docs/docs/components/dentry/searchbar/index.md +317 -0
  38. package/docs/docs/components/dentry/selector/index.md +295 -0
  39. package/docs/docs/components/dentry/switch/index.md +300 -0
  40. package/docs/docs/components/dentry/textarea/index.md +231 -0
  41. package/docs/docs/components/dentry/uploader/index.md +745 -0
  42. package/docs/docs/components/exhibition/collapse/index.md +339 -0
  43. package/docs/docs/components/exhibition/swiper/index.md +385 -0
  44. package/docs/docs/components/exhibition/tag/index.md +253 -0
  45. package/docs/docs/components/feedback/dialog/index.md +306 -0
  46. package/docs/docs/components/feedback/drag/index.md +164 -0
  47. package/docs/docs/components/feedback/empty/index.md +211 -0
  48. package/docs/docs/components/feedback/infiniteloading/index.md +397 -0
  49. package/docs/docs/components/feedback/noticebar/index.md +175 -0
  50. package/docs/docs/components/feedback/popup/index.md +563 -0
  51. package/docs/docs/components/feedback/pulltorefresh/index.md +254 -0
  52. package/docs/docs/components/feedback/toast/index.md +355 -0
  53. package/docs/docs/components/layout/divider/index.md +162 -0
  54. package/docs/docs/components/layout/grid/index.md +386 -0
  55. package/docs/docs/components/layout/space/index.md +196 -0
  56. package/docs/docs/components/nav/tabs/index.md +955 -0
  57. package/docs/docs/components-index.json +233 -0
  58. package/package.json +34 -0
@@ -0,0 +1,306 @@
1
+ ---
2
+ order: 3
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/feedback/pages/dialog/index'
4
+ group:
5
+ title: 操作反馈
6
+ order: 6
7
+ ---
8
+
9
+ # Dialog 对话框 <Badge>2.0.0</Badge>
10
+
11
+
12
+ 模态对话框,在浮层中显示,引导用户进行相关操作,常用于消息提示、消息确认,或在当前页面内完成特定的交互操作。
13
+
14
+ 弹出框组件支持函数调用和组件调用两种方式。
15
+
16
+ ## 引入
17
+
18
+ ```tsx
19
+ import { Dialog } from '@mijadesign/mjui-react-taro'
20
+ ```
21
+
22
+ ## 示例代码
23
+
24
+ ### 组件类型
25
+
26
+
27
+ ```tsx
28
+ import { Button, Dialog, Space } from '@mijadesign/mjui-react-taro'
29
+ import React from 'react'
30
+
31
+ const Demo1 = () => {
32
+ return (
33
+ <Space direction="vertical" style={{ padding: '0 12px' }}>
34
+ <Dialog id="demo" />
35
+ <div>01 反馈类对话框</div>
36
+ <Button
37
+ type="primary"
38
+ fill="outline"
39
+ block
40
+ onClick={() =>
41
+ Dialog.open('demo', {
42
+ title: '对话框标题',
43
+ content: '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
44
+ hideCancelButton: true,
45
+ confirmText: '我知道了',
46
+ onConfirm: () => {
47
+ Dialog.close('demo')
48
+ },
49
+ onCancel: () => {
50
+ Dialog.close('demo')
51
+ },
52
+ })
53
+ }
54
+ >
55
+ 反馈类-基础
56
+ </Button>
57
+ <Button
58
+ type="primary"
59
+ fill="outline"
60
+ block
61
+ onClick={() =>
62
+ Dialog.open('demo', {
63
+ title: '对话框标题',
64
+ content: '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
65
+ footerDirection: 'vertical',
66
+ cancelText: '不同意',
67
+ confirmText: '知道了',
68
+ onConfirm: () => {
69
+ Dialog.close('demo')
70
+ },
71
+ onCancel: () => {
72
+ Dialog.close('demo')
73
+ },
74
+ })
75
+ }
76
+ >
77
+ 反馈类-主次按钮
78
+ </Button>
79
+ <Button
80
+ type="primary"
81
+ fill="outline"
82
+ block
83
+ onClick={() =>
84
+ Dialog.open('demo', {
85
+ title: '仅一行重要的提示文案时使用,仅标题样式,建议内容控制在两行',
86
+ hideCancelButton: true,
87
+ confirmText: '我知道了',
88
+ onConfirm: () => {
89
+ Dialog.close('demo')
90
+ },
91
+ onCancel: () => {
92
+ Dialog.close('demo')
93
+ },
94
+ })
95
+ }
96
+ >
97
+ 反馈类-仅标题
98
+ </Button>
99
+ <Button
100
+ type="primary"
101
+ fill="outline"
102
+ block
103
+ onClick={() =>
104
+ Dialog.open('demo', {
105
+ title: '对话框标题',
106
+ content:
107
+ '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
108
+ hideCancelButton: true,
109
+ confirmText: '我知道了',
110
+ onConfirm: () => {
111
+ Dialog.close('demo')
112
+ },
113
+ onCancel: () => {
114
+ Dialog.close('demo')
115
+ },
116
+ })
117
+ }
118
+ >
119
+ 反馈类-内容超长
120
+ </Button>
121
+ <Button
122
+ type="primary"
123
+ fill="outline"
124
+ block
125
+ onClick={() =>
126
+ Dialog.open('demo', {
127
+ title: '对话框标题',
128
+ content: '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
129
+ hideCancelButton: true,
130
+ confirmText: '我知道了',
131
+ closeIcon: true,
132
+ onConfirm: () => {
133
+ Dialog.close('demo')
134
+ },
135
+ onCancel: () => {
136
+ Dialog.close('demo')
137
+ },
138
+ })
139
+ }
140
+ >
141
+ 反馈类-可关闭
142
+ </Button>
143
+ <div>02 确认类对话框</div>
144
+ <Button
145
+ type="primary"
146
+ fill="outline"
147
+ block
148
+ onClick={() =>
149
+ Dialog.open('demo', {
150
+ title: '对话框标题',
151
+ content: '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
152
+ confirmText: '知道了',
153
+ onConfirm: () => {
154
+ Dialog.close('demo')
155
+ },
156
+ onCancel: () => {
157
+ Dialog.close('demo')
158
+ },
159
+ })
160
+ }
161
+ >
162
+ 确认类-基础
163
+ </Button>
164
+ <Button
165
+ type="primary"
166
+ fill="outline"
167
+ block
168
+ onClick={() =>
169
+ Dialog.open('demo', {
170
+ content: '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
171
+ confirmText: '知道了',
172
+ onConfirm: () => {
173
+ Dialog.close('demo')
174
+ },
175
+ onCancel: () => {
176
+ Dialog.close('demo')
177
+ },
178
+ })
179
+ }
180
+ >
181
+ 确认类-无标题
182
+ </Button>
183
+ </Space>
184
+ )
185
+ }
186
+ export default Demo1
187
+
188
+ ```
189
+
190
+ ### 其他类型
191
+
192
+
193
+ ```tsx
194
+ import { Button, Dialog, Space } from '@mijadesign/mjui-react-taro'
195
+ import React from 'react'
196
+
197
+ const Demo2 = () => {
198
+ return (
199
+ <Space direction="vertical" style={{ padding: '0 12px' }}>
200
+ <Dialog id="demo1" />
201
+ <Button
202
+ fill="outline"
203
+ block
204
+ type="primary"
205
+ onClick={() =>
206
+ Dialog.open('demo1', {
207
+ title: '对话框标题',
208
+ content: '告知当前状态、信息和解决方法等内容,描述文案尽可能控制在三行内描述文案尽可能控制在三行内',
209
+ onConfirm: () => {
210
+ Dialog.close('demo1')
211
+ },
212
+ onCancel: () => {
213
+ Dialog.close('demo1')
214
+ },
215
+ confirmButtonProps: {
216
+ type: 'danger',
217
+ },
218
+ })
219
+ }
220
+ >
221
+ 确认类-按钮颜色配置
222
+ </Button>
223
+ </Space>
224
+ )
225
+ }
226
+ export default Demo2
227
+
228
+ ```
229
+
230
+ ## Dialog
231
+
232
+ ### Props
233
+
234
+ | 属性 | 说明 | 类型 | 默认值 |
235
+ | --- | --- | --- | --- |
236
+ | visible | 对话框是否可见 | `boolean` | `-` |
237
+ | header | 自定义页头,传入 null 则不显示 | `ReactNode` | `-` |
238
+ | title | 标题 | `ReactNode` | `-` |
239
+ | content | 对话框的内容,适用于函数式调用 | `ReactNode` | `-` |
240
+ | footer | 自定义页脚,传入 null 则不显示 | `ReactNode` | `-` |
241
+ | confirmText | 确认按钮文案 | `ReactNode` | `确定` |
242
+ | cancelText | 取消按钮文案 | `ReactNode` | `取消` |
243
+ | overlay | 是否展示遮罩 | `boolean` | `true` |
244
+ | hideConfirmButton | 是否隐藏确定按钮 | `boolean` | `false` |
245
+ | hideCancelButton | 是否隐藏取消按钮 | `boolean` | `false` |
246
+ | disableConfirmButton | 禁用确定按钮 | `boolean` | `false` |
247
+ | closeIcon | 关闭按钮 | `boolean` \| `ReactNode` | `false` |
248
+ | closeIconPosition | 关闭按钮位置 | `top-left` \| `top-right` \| `bottom` | `top-right` |
249
+ | closeOnOverlayClick | 点击蒙层是否关闭对话框 | `boolean` | `true` |
250
+ | footerDirection | 使用横纵方向 可选值 horizontal、vertical | `string` | `horizontal` |
251
+ | lockScroll | 背景是否锁定 | `boolean` | `false` |
252
+ | beforeCancel | 取消前回调,点击取消时触发 | `() => boolean` | `-` |
253
+ | beforeClose | 关闭前回调 | `() => boolean` | `-` |
254
+ | onConfirm | 确定按钮回调 | `(e?: MouseEvent) => Promise \| void` | `-` |
255
+ | onCancel | 取消按钮回调 | `() => void` | `-` |
256
+ | onClose | 关闭回调,任何情况关闭弹窗都会触发 | `() => void` | `-` |
257
+ | onClick | 点击自身回调 | `() => void` | `-` |
258
+ | onOverlayClick | 点击蒙层触发 | `() => void` | `-` |
259
+ | contentAlign | 内容对齐类型 | `left` \| `center` \| `right` | `left` |
260
+
261
+ ### Methods
262
+ | 方法名 | 说明 | 类型 |
263
+ | --- | --- | --- |
264
+ | Dialog.open | 打开 Dialog | (id: string, options: DialogOptions) => void |
265
+ | Dialog.close | 关闭 Dialog | (id: string) => void |
266
+
267
+ DialogOptions 是 DialogProps 的子集,包含如下属性:title, content, footer, confirmText, cancelText, overlay, closeOnOverlayClick, hideConfirmButton, hideCancelButton, disableConfirmButton, footerDirection, lockScroll, beforeCancel, beforeClose, onOverlayClick,
268
+
269
+ ## 主题定制
270
+
271
+ ### 样式变量
272
+
273
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
274
+
275
+ | 名称 | 说明 | 默认值 |
276
+ | --- | --- | --- |
277
+ | \--nutui-dialog-border-radius | 对话框圆角 | `$radius-3` |
278
+ | \--nutui-dialog-bottom-close-icon-size | 对话框底部关闭按钮的宽高 | `24px` |
279
+ | \--nutui-dialog-cancel-color | 取消按钮的颜色 | `$color-title` |
280
+ | \--nutui-dialog-cancel-font-size | 取消按钮的字号 | `$font-size-2` |
281
+ | \--nutui-dialog-close-color | 对话框关闭按钮的颜色 | `$color-title` |
282
+ | \--nutui-dialog-close-height | 对话框关闭按钮的高度 | `$dialog-icon-font-size` |
283
+ | \--nutui-dialog-close-left | 对话框关闭按钮的left值 | `$spacing-2` |
284
+ | \--nutui-dialog-close-right | 对话框关闭按钮的right值 | `$spacing-2` |
285
+ | \--nutui-dialog-close-top | 对话框关闭按钮的top值 | `$spacing-2` |
286
+ | \--nutui-dialog-close-width | 对话框关闭按钮的宽度 | `$dialog-icon-font-size` |
287
+ | \--nutui-dialog-content-line-height | 对话框内容行高 | `20px` |
288
+ | \--nutui-dialog-content-margin | 对话框内容 margin | `$spacing-1 0 $spacing-5 0` |
289
+ | \--nutui-dialog-content-max-height | 对话框内容最大高度 | `268px` |
290
+ | \--nutui-dialog-content-text-align | 对话框内容文本对齐方式 | `left` |
291
+ | \--nutui-dialog-footer-button-min-width | 对话框底部按钮最小宽度 | `117px` |
292
+ | \--nutui-dialog-footer-cancel-bg | 取消按钮的背景色 | `$button-default-background-color` |
293
+ | \--nutui-dialog-footer-cancel-margin-right | 对话框取消按钮的margin-right | `12px` |
294
+ | \--nutui-dialog-footer-justify-content | 对话框底部按钮排布 | `space-around` |
295
+ | \--nutui-dialog-footer-ok-max-width | 对话框确认按钮的最大宽度 | `128px` |
296
+ | \--nutui-dialog-header-font-size | 对话框标题字体大小 | `$font-size-3` |
297
+ | \--nutui-dialog-header-font-weight | 对话框标题字重 | `$font-weight-bold` |
298
+ | \--nutui-dialog-icon-font-size | icon的大小 | `20px` |
299
+ | \--nutui-dialog-max-height | 对话框最大高度 | `420px` |
300
+ | \--nutui-dialog-min-height | 对话框最小高度 | `124px` |
301
+ | \--nutui-dialog-min-width | 对话框最小宽度 | `240px` |
302
+ | \--nutui-dialog-padding | 对话框padding | `$spacing-5` |
303
+ | \--nutui-dialog-vertical-footer-ok-margin-top | 对话框底部按钮纵向排布时的margin值 | `5px` |
304
+ | \--nutui-dialog-width | 对话框宽度 | `295px` |
305
+ | \--nutui-dialog-z-index | 对话框的z-index | `$mask-content-z-index` |
306
+
@@ -0,0 +1,164 @@
1
+ ---
2
+ order: 4
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/feedback/pages/drag/index'
4
+ group:
5
+ title: 操作反馈
6
+ order: 6
7
+ ---
8
+
9
+ # Drag 拖拽 <Badge>2.0.0</Badge>
10
+
11
+
12
+ 实现可拖拽的任意元素
13
+
14
+ ## 引入
15
+
16
+ ```tsx
17
+ import { Drag } from '@mijadesign/mjui-react-taro'
18
+ ```
19
+
20
+ ## 示例代码
21
+
22
+ ### 基础用法
23
+
24
+
25
+ ```tsx
26
+ import { Button, Drag } from '@mijadesign/mjui-react-taro'
27
+ import Taro from '@tarojs/taro'
28
+ import React from 'react'
29
+
30
+ const Demo1 = () => {
31
+ const isTaroWeb = Taro.getEnv() === 'WEB'
32
+ return (
33
+ <Drag style={{ left: '16px', top: isTaroWeb ? '102px' : '40px' }} className="drag-demo1">
34
+ <Button type="primary">drag</Button>
35
+ </Drag>
36
+ )
37
+ }
38
+ export default Demo1
39
+
40
+ ```
41
+
42
+ ### 限制拖拽方向
43
+
44
+
45
+ ```tsx
46
+ import { Button, Drag } from '@mijadesign/mjui-react-taro'
47
+ import Taro from '@tarojs/taro'
48
+ import React from 'react'
49
+
50
+ const Demo2 = () => {
51
+ const isTaroWeb = Taro.getEnv() === 'WEB'
52
+ return (
53
+ <>
54
+ <Drag
55
+ direction="x"
56
+ style={{
57
+ top: isTaroWeb ? '184px' : '116px',
58
+ left: '16px',
59
+ }}
60
+ className="drag-demo21"
61
+ >
62
+ <Button type="primary">X</Button>
63
+ </Drag>
64
+ <Drag
65
+ direction="y"
66
+ style={{
67
+ top: isTaroWeb ? '184px' : '116px',
68
+ right: '62px',
69
+ }}
70
+ className="drag-demo22"
71
+ >
72
+ <Button type="primary">Y</Button>
73
+ </Drag>
74
+ </>
75
+ )
76
+ }
77
+ export default Demo2
78
+
79
+ ```
80
+
81
+ ### 自动吸边
82
+
83
+
84
+ ```tsx
85
+ import { Button, Drag } from '@mijadesign/mjui-react-taro'
86
+ import Taro from '@tarojs/taro'
87
+ import React from 'react'
88
+
89
+ const Demo3 = () => {
90
+ const isTaroWeb = Taro.getEnv() === 'WEB'
91
+
92
+ return (
93
+ <Drag
94
+ direction="x"
95
+ attract
96
+ style={{
97
+ top: isTaroWeb ? '264px' : '192px',
98
+ left: '16px',
99
+ }}
100
+ className="drag-demo3"
101
+ >
102
+ <Button type="primary">attract</Button>
103
+ </Drag>
104
+ )
105
+ }
106
+ export default Demo3
107
+
108
+ ```
109
+
110
+ ### 限制拖拽边界
111
+
112
+
113
+ ```tsx
114
+ import { Button, Drag } from '@mijadesign/mjui-react-taro'
115
+ import Taro, { getSystemInfoSync } from '@tarojs/taro'
116
+ import React from 'react'
117
+
118
+ const Demo4 = () => {
119
+ const { screenWidth, windowHeight, screenHeight } = getSystemInfoSync()
120
+
121
+ const isTaroWeb = Taro.getEnv() === 'WEB'
122
+
123
+ const right = () => {
124
+ return screenWidth - 300 - 9
125
+ }
126
+ const bottom = () => {
127
+ return windowHeight - 501 - 57
128
+ }
129
+ return (
130
+ <>
131
+ <div
132
+ className="drag-boundary"
133
+ style={{
134
+ position: 'absolute',
135
+ top: isTaroWeb ? '350px' : '274px',
136
+ left: '16px',
137
+ width: '300px',
138
+ height: '200px',
139
+ border: '1px solid var(--nutui-color-primary)',
140
+ }}
141
+ />
142
+ <Drag
143
+ className="drag-demo4"
144
+ boundary={{ top: 361, left: 9, bottom: bottom(), right: right() }}
145
+ style={{ top: '360px', left: '50px' }}
146
+ >
147
+ <Button type="primary">boundary</Button>
148
+ </Drag>
149
+ </>
150
+ )
151
+ }
152
+ export default Demo4
153
+
154
+ ```
155
+
156
+ ## Drag
157
+
158
+ ### Props
159
+
160
+ | 属性 | 说明 | 类型 | 默认值 |
161
+ | --- | --- | --- | --- |
162
+ | attract | 是否开启自动吸边 | `boolean` | `false` |
163
+ | direction | 拖拽元素的拖拽方向限制 | `x` \| `y` \| `all` | `all` |
164
+ | boundary | 拖拽元素的拖拽边界 | `Object` | `{top: 0, left: 0, right: 0, bottom: 0}` |
@@ -0,0 +1,211 @@
1
+ ---
2
+ order: 5
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/feedback/pages/empty/index'
4
+ group:
5
+ title: 操作反馈
6
+ order: 6
7
+ ---
8
+
9
+ # Empty 空状态 <Badge>2.0.0</Badge>
10
+
11
+ 空状态时的占位提示
12
+
13
+ ## 引入
14
+
15
+ ```tsx
16
+ import { Empty } from '@mijadesign/mjui-react-taro'
17
+ ```
18
+
19
+ ## 示例代码
20
+
21
+ ### 基础用法
22
+
23
+
24
+ ```tsx
25
+ import React from 'react'
26
+ import { Button, Empty } from '@mijadesign/mjui-react-taro'
27
+ import Taro from '@tarojs/taro'
28
+
29
+ const Demo1 = () => {
30
+ const styles = { backgroundColor: 'white', marginBottom: '12px', padding: '20px 0' }
31
+ return (
32
+ <>
33
+ <div style={styles}>
34
+ <Empty description="暂无信息" />
35
+ </div>
36
+ <div style={styles}>
37
+ <Empty title="标题" description="暂无信息" />
38
+ </div>
39
+ <div style={styles}>
40
+ <Empty title="标题" description="暂无信息" />
41
+ <div style={{ backgroundColor: 'white', margin: `${Taro.pxTransform(24)} ${Taro.pxTransform(45)} 0` }}>
42
+ <Button block type="primary">
43
+ 主要按钮
44
+ </Button>
45
+ </div>
46
+ </div>
47
+ </>
48
+ )
49
+ }
50
+ export default Demo1
51
+
52
+ ```
53
+
54
+ ### 底部按钮
55
+
56
+
57
+ ```tsx
58
+ import React from 'react'
59
+ import { Empty, Button, Row, Col } from '@mijadesign/mjui-react-taro'
60
+ import Taro from '@tarojs/taro'
61
+
62
+ const Demo6 = () => {
63
+ const styles = { backgroundColor: 'white', marginBottom: '12px', padding: '20px 0' }
64
+
65
+ return (
66
+ <>
67
+ <div style={styles}>
68
+ <Empty description="暂无信息" />
69
+ <div style={{ backgroundColor: 'white', margin: `${Taro.pxTransform(24)} ${Taro.pxTransform(105)} 0` }}>
70
+ <Button block type="primary" fill="outline">
71
+ 次要按钮
72
+ </Button>
73
+ </div>
74
+ </div>
75
+ <div style={styles}>
76
+ <Empty status="error" description="加载失败" />
77
+ <div style={{ margin: `${Taro.pxTransform(24)} ${Taro.pxTransform(45)} 0` }}>
78
+ <Row gutter="12">
79
+ <Col span="12" style={{ marginBottom: '0' }}>
80
+ <Button block fill="outline">
81
+ 次要按钮
82
+ </Button>
83
+ </Col>
84
+ <Col span="12" style={{ marginBottom: '0' }}>
85
+ <Button block type="primary">
86
+ 主要按钮
87
+ </Button>
88
+ </Col>
89
+ </Row>
90
+ </div>
91
+ </div>
92
+ </>
93
+ )
94
+ }
95
+ export default Demo6
96
+
97
+ ```
98
+
99
+ ### 空状态图片类型
100
+
101
+
102
+ ```tsx
103
+ import React, { useState } from 'react'
104
+ import { Empty, Tabs } from '@mijadesign/mjui-react-taro'
105
+
106
+ const Demo5 = () => {
107
+ const [tab1value, setTab1value] = useState<string | number>('0')
108
+ return (
109
+ <Tabs
110
+ contentAnimation={false}
111
+ value={tab1value}
112
+ onChange={(value) => {
113
+ setTab1value(value)
114
+ }}
115
+ style={{ background: 'white' }}
116
+ >
117
+ <Tabs.TabPane title="无内容">
118
+ <Empty
119
+ description="暂无信息"
120
+ image={<img src="https://sblp-oss.mibaodata.com/static/front-end/empty.png" alt="" />}
121
+ />
122
+ </Tabs.TabPane>
123
+ <Tabs.TabPane title="无银行卡">
124
+ <Empty
125
+ description="您还没有添加银行卡"
126
+ image={<img src="https://sblp-oss.mibaodata.com/static/front-end/empty_bank.png" alt="" />}
127
+ />
128
+ </Tabs.TabPane>
129
+ <Tabs.TabPane title="无网络">
130
+ <Empty
131
+ description="网络出错了"
132
+ image={<img src="https://sblp-oss.mibaodata.com/static/front-end/empty_network.png" alt="" />}
133
+ />
134
+ </Tabs.TabPane>
135
+ </Tabs>
136
+ )
137
+ }
138
+ export default Demo5
139
+
140
+ ```
141
+
142
+ ### Size 为 small 时,可用于半屏
143
+
144
+ > 如果您是京东站内相关项目的开发,我们特意为您提供了一系列的缺省状态的图片链接,您可通过内部群获取。
145
+
146
+
147
+ ```tsx
148
+ import React from 'react'
149
+ import { Empty } from '@mijadesign/mjui-react-taro'
150
+
151
+ const Demo2 = () => {
152
+ const styles = { backgroundColor: 'white', marginBottom: '12px', padding: '20px 0' }
153
+ return (
154
+ <div style={styles}>
155
+ <Empty description="无数据" size="small" />
156
+ </div>
157
+ )
158
+ }
159
+ export default Demo2
160
+
161
+ ```
162
+
163
+ ### 自定义内容大小
164
+
165
+
166
+ ```tsx
167
+ import React from 'react'
168
+ import { Empty } from '@mijadesign/mjui-react-taro'
169
+
170
+ const Demo3 = () => {
171
+ const styles = { backgroundColor: 'white', marginBottom: '12px', padding: '20px 0' }
172
+ return (
173
+ <div style={styles}>
174
+ <Empty description="无数据" imageSize={200} />
175
+ </div>
176
+ )
177
+ }
178
+ export default Demo3
179
+
180
+ ```
181
+
182
+ ## Empty
183
+
184
+ ### Props
185
+
186
+ | 属性 | 说明 | 类型 | 默认值 |
187
+ | --- | --- | --- | --- |
188
+ | image | 图片,支持传入图片 URL | `ReactNode` | `-` |
189
+ | imageSize | 图片大小,number 类型单位为 px | `number` \| `string` | `-` |
190
+ | title | 图片下方的标题 | `ReactNode` | `-` |
191
+ | description | 图片下方的描述文字 | `ReactNode` | `-` |
192
+ | size | 组件整体大小,适配于全屏或半屏 | `small` \| `base` | `base` |
193
+ | status | 默认图片错误类型 | `empty` \| `error` \| `network` | `empty` |
194
+ | actions | 可用于处理操作的一组数据 | `Array` | `[]` |
195
+
196
+ ## 主题定制
197
+
198
+ ### 样式变量
199
+
200
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
201
+
202
+ | 名称 | 说明 | 默认值 |
203
+ | --- | --- | --- |
204
+ | \--nutui-empty-padding | Empty组件图片的padding值 | `32px 40px` |
205
+ | \--nutui-empty-image-size | Empty组件图片的尺寸大小 | `160px` |
206
+ | \--nutui-empty-image-small-size | size 为 small 时,Empty组件图片的尺寸大小 | `120px` |
207
+ | \--nutui-empty-title-margin-top | Empty组件图片标题margin-top的值 | `0px` |
208
+ | \--nutui-empty-title-margin-top | Empty组件图片标题margin-top的值 | `8px` |
209
+ | \--nutui-empty-title-line-height | Empty组件图片标题行高 | `$font-size-base` |
210
+ | \--nutui-empty-description-margin-top | Empty组件图片描述margin-top的值 | `4px` |
211
+ | \--nutui-empty-description-line-height | Empty组件图片描述行高 | `1.2` |