@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.
- package/README.md +147 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/services/aliases.service.d.ts +1 -0
- package/dist/services/aliases.service.js +19 -0
- package/dist/services/doc-parser.service.d.ts +3 -0
- package/dist/services/doc-parser.service.js +162 -0
- package/dist/services/index.services.d.ts +3 -0
- package/dist/services/index.services.js +71 -0
- package/dist/services/paths.service.d.ts +5 -0
- package/dist/services/paths.service.js +18 -0
- package/dist/tools/base.tool.d.ts +8 -0
- package/dist/tools/base.tool.js +27 -0
- package/dist/tools/get-component-doc.tool.d.ts +12 -0
- package/dist/tools/get-component-doc.tool.js +40 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/list-components.tool.d.ts +8 -0
- package/dist/tools/list-components.tool.js +32 -0
- package/dist/tools/search-components.tool.d.ts +12 -0
- package/dist/tools/search-components.tool.js +61 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/index.js +1 -0
- package/docs/docs/aliases.json +59 -0
- package/docs/docs/components/base/button/index.md +415 -0
- package/docs/docs/components/base/cell/index.md +279 -0
- package/docs/docs/components/base/configprovider/index.md +215 -0
- package/docs/docs/components/base/image/index.md +282 -0
- package/docs/docs/components/base/overlay/index.md +288 -0
- package/docs/docs/components/dentry/cascader/index.md +1080 -0
- package/docs/docs/components/dentry/checkbox/index.md +842 -0
- package/docs/docs/components/dentry/datepicker/index.md +489 -0
- package/docs/docs/components/dentry/form/index.md +457 -0
- package/docs/docs/components/dentry/input/index.md +257 -0
- package/docs/docs/components/dentry/picker/index.md +621 -0
- package/docs/docs/components/dentry/radio/index.md +364 -0
- package/docs/docs/components/dentry/searchbar/index.md +317 -0
- package/docs/docs/components/dentry/selector/index.md +295 -0
- package/docs/docs/components/dentry/switch/index.md +300 -0
- package/docs/docs/components/dentry/textarea/index.md +231 -0
- package/docs/docs/components/dentry/uploader/index.md +745 -0
- package/docs/docs/components/exhibition/collapse/index.md +339 -0
- package/docs/docs/components/exhibition/swiper/index.md +385 -0
- package/docs/docs/components/exhibition/tag/index.md +253 -0
- package/docs/docs/components/feedback/dialog/index.md +306 -0
- package/docs/docs/components/feedback/drag/index.md +164 -0
- package/docs/docs/components/feedback/empty/index.md +211 -0
- package/docs/docs/components/feedback/infiniteloading/index.md +397 -0
- package/docs/docs/components/feedback/noticebar/index.md +175 -0
- package/docs/docs/components/feedback/popup/index.md +563 -0
- package/docs/docs/components/feedback/pulltorefresh/index.md +254 -0
- package/docs/docs/components/feedback/toast/index.md +355 -0
- package/docs/docs/components/layout/divider/index.md +162 -0
- package/docs/docs/components/layout/grid/index.md +386 -0
- package/docs/docs/components/layout/space/index.md +196 -0
- package/docs/docs/components/nav/tabs/index.md +955 -0
- package/docs/docs/components-index.json +233 -0
- package/package.json +34 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 6
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/feedback/pages/infiniteloading/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 操作反馈
|
|
6
|
+
order: 6
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# InfiniteLoading 滚动加载 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
列表滚动到底部自动加载更多数据。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { InfiniteLoading } from '@mijadesign/mjui-react-taro'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Cell, InfiniteLoading } from '@mijadesign/mjui-react-taro'
|
|
27
|
+
import React, { CSSProperties, useEffect, useState } from 'react'
|
|
28
|
+
|
|
29
|
+
const sleep = (time: number): Promise<unknown> =>
|
|
30
|
+
new Promise((resolve) => {
|
|
31
|
+
setTimeout(resolve, time)
|
|
32
|
+
})
|
|
33
|
+
const InfiniteUlStyle: CSSProperties = {
|
|
34
|
+
height: '300px',
|
|
35
|
+
width: '100%',
|
|
36
|
+
padding: '0',
|
|
37
|
+
overflowY: 'auto',
|
|
38
|
+
overflowX: 'hidden',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const InfiniteLiStyle: CSSProperties = {
|
|
42
|
+
marginTop: '10px',
|
|
43
|
+
fontSize: '14px',
|
|
44
|
+
color: 'rgba(100, 100, 100, 1)',
|
|
45
|
+
textAlign: 'center',
|
|
46
|
+
}
|
|
47
|
+
const Demo1 = () => {
|
|
48
|
+
const [defaultList, setDefaultList] = useState<string[]>([])
|
|
49
|
+
const [hasMore, setHasMore] = useState(true)
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
init()
|
|
53
|
+
}, [])
|
|
54
|
+
|
|
55
|
+
const loadMore = async () => {
|
|
56
|
+
await sleep(2000)
|
|
57
|
+
const curLen = defaultList.length
|
|
58
|
+
for (let i = curLen; i < curLen + 10; i++) {
|
|
59
|
+
defaultList.push(`${i}`)
|
|
60
|
+
}
|
|
61
|
+
if (defaultList.length >= 30) {
|
|
62
|
+
setHasMore(false)
|
|
63
|
+
} else {
|
|
64
|
+
setDefaultList([...defaultList])
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const init = () => {
|
|
69
|
+
for (let i = 0; i < 10; i++) {
|
|
70
|
+
defaultList.push(`${i}`)
|
|
71
|
+
}
|
|
72
|
+
setDefaultList([...defaultList])
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<Cell>
|
|
78
|
+
<ul style={InfiniteUlStyle} id="scroll">
|
|
79
|
+
<InfiniteLoading
|
|
80
|
+
target="scroll"
|
|
81
|
+
hasMore={hasMore}
|
|
82
|
+
onLoadMore={loadMore}
|
|
83
|
+
loadingText={<>加载中</>}
|
|
84
|
+
loadMoreText={<>没有更多了</>}
|
|
85
|
+
>
|
|
86
|
+
{defaultList.map((item, index) => {
|
|
87
|
+
return (
|
|
88
|
+
<li style={InfiniteLiStyle} key={index}>
|
|
89
|
+
{item}
|
|
90
|
+
</li>
|
|
91
|
+
)
|
|
92
|
+
})}
|
|
93
|
+
</InfiniteLoading>
|
|
94
|
+
</ul>
|
|
95
|
+
</Cell>
|
|
96
|
+
</>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
export default Demo1
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 下拉刷新
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { Cell, InfiniteLoading, Toast } from '@mijadesign/mjui-react-taro'
|
|
108
|
+
import React, { CSSProperties, useEffect, useState } from 'react'
|
|
109
|
+
|
|
110
|
+
const sleep = (time: number): Promise<unknown> =>
|
|
111
|
+
new Promise((resolve) => {
|
|
112
|
+
setTimeout(resolve, time)
|
|
113
|
+
})
|
|
114
|
+
const InfiniteUlStyle: CSSProperties = {
|
|
115
|
+
height: '300px',
|
|
116
|
+
width: '100%',
|
|
117
|
+
padding: '0',
|
|
118
|
+
overflowY: 'auto',
|
|
119
|
+
overflowX: 'hidden',
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const InfiniteLiStyle: CSSProperties = {
|
|
123
|
+
marginTop: '10px',
|
|
124
|
+
fontSize: '14px',
|
|
125
|
+
color: 'rgba(100, 100, 100, 1)',
|
|
126
|
+
textAlign: 'center',
|
|
127
|
+
}
|
|
128
|
+
const Demo2 = () => {
|
|
129
|
+
const [refreshList, setRefreshList] = useState<string[]>([])
|
|
130
|
+
const [refreshHasMore, setRefreshHasMore] = useState(true)
|
|
131
|
+
|
|
132
|
+
const [show, SetShow] = useState(false)
|
|
133
|
+
const [toastMsg, SetToastMsg] = useState('')
|
|
134
|
+
const toastShow = (msg: any) => {
|
|
135
|
+
SetToastMsg(msg)
|
|
136
|
+
SetShow(true)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
init()
|
|
141
|
+
}, [])
|
|
142
|
+
|
|
143
|
+
const init = () => {
|
|
144
|
+
for (let i = 0; i < 10; i++) {
|
|
145
|
+
refreshList.push(`${i}`)
|
|
146
|
+
}
|
|
147
|
+
setRefreshList([...refreshList])
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const refreshLoadMore = async () => {
|
|
151
|
+
await sleep(2000)
|
|
152
|
+
const curLen = refreshList.length
|
|
153
|
+
for (let i = curLen; i < curLen + 10; i++) {
|
|
154
|
+
refreshList.push(`${i}`)
|
|
155
|
+
}
|
|
156
|
+
if (refreshList.length >= 30) {
|
|
157
|
+
setRefreshHasMore(false)
|
|
158
|
+
} else {
|
|
159
|
+
setRefreshList([...refreshList])
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const refresh = async () => {
|
|
164
|
+
await sleep(1000)
|
|
165
|
+
toastShow('刷新成功')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<>
|
|
170
|
+
<Cell>
|
|
171
|
+
<ul id="refreshScroll" style={InfiniteUlStyle}>
|
|
172
|
+
<InfiniteLoading
|
|
173
|
+
pullingText={<>下拉刷新</>}
|
|
174
|
+
loadingText={<>加载中</>}
|
|
175
|
+
target="refreshScroll"
|
|
176
|
+
pullRefresh
|
|
177
|
+
hasMore={refreshHasMore}
|
|
178
|
+
onLoadMore={refreshLoadMore}
|
|
179
|
+
onRefresh={refresh}
|
|
180
|
+
>
|
|
181
|
+
{refreshList.map((item, index) => {
|
|
182
|
+
return (
|
|
183
|
+
<li className="infiniteLi" key={index} style={InfiniteLiStyle}>
|
|
184
|
+
{item}
|
|
185
|
+
</li>
|
|
186
|
+
)
|
|
187
|
+
})}
|
|
188
|
+
</InfiniteLoading>
|
|
189
|
+
</ul>
|
|
190
|
+
<Toast
|
|
191
|
+
type="text"
|
|
192
|
+
visible={show}
|
|
193
|
+
content={toastMsg}
|
|
194
|
+
onClose={() => {
|
|
195
|
+
SetShow(false)
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
198
|
+
</Cell>
|
|
199
|
+
</>
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
export default Demo2
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 自定义加载文案
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import React, { useState, useEffect, CSSProperties } from 'react'
|
|
211
|
+
import { Cell, InfiniteLoading } from '@mijadesign/mjui-react-taro'
|
|
212
|
+
|
|
213
|
+
const sleep = (time: number): Promise<unknown> =>
|
|
214
|
+
new Promise((resolve) => {
|
|
215
|
+
setTimeout(resolve, time)
|
|
216
|
+
})
|
|
217
|
+
const InfiniteUlStyle: CSSProperties = {
|
|
218
|
+
height: '300px',
|
|
219
|
+
width: '100%',
|
|
220
|
+
padding: '0',
|
|
221
|
+
overflowY: 'auto',
|
|
222
|
+
overflowX: 'hidden',
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const InfiniteLiStyle: CSSProperties = {
|
|
226
|
+
marginTop: '10px',
|
|
227
|
+
fontSize: '14px',
|
|
228
|
+
color: 'rgba(100, 100, 100, 1)',
|
|
229
|
+
textAlign: 'center',
|
|
230
|
+
}
|
|
231
|
+
const Demo3 = () => {
|
|
232
|
+
const [customList, setCustomList] = useState<string[]>([])
|
|
233
|
+
const [customHasMore, setCustomHasMore] = useState(true)
|
|
234
|
+
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
init()
|
|
237
|
+
}, [])
|
|
238
|
+
|
|
239
|
+
const init = () => {
|
|
240
|
+
for (let i = 0; i < 10; i++) {
|
|
241
|
+
customList.push(`${i}`)
|
|
242
|
+
}
|
|
243
|
+
setCustomList([...customList])
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const customLoadMore = async () => {
|
|
247
|
+
await sleep(2000)
|
|
248
|
+
const curLen = customList.length
|
|
249
|
+
for (let i = curLen; i < curLen + 10; i++) {
|
|
250
|
+
customList.push(`${i}`)
|
|
251
|
+
}
|
|
252
|
+
if (customList.length >= 30) {
|
|
253
|
+
setCustomHasMore(false)
|
|
254
|
+
} else {
|
|
255
|
+
setCustomList([...customList])
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<>
|
|
261
|
+
<Cell>
|
|
262
|
+
<ul id="customScroll" style={InfiniteUlStyle}>
|
|
263
|
+
<InfiniteLoading
|
|
264
|
+
target="customScroll"
|
|
265
|
+
loadingText="loading"
|
|
266
|
+
loadMoreText="没有啦~"
|
|
267
|
+
hasMore={customHasMore}
|
|
268
|
+
onLoadMore={customLoadMore}
|
|
269
|
+
>
|
|
270
|
+
{customList.map((item, index) => {
|
|
271
|
+
return (
|
|
272
|
+
<li key={index} style={InfiniteLiStyle}>
|
|
273
|
+
{item}
|
|
274
|
+
</li>
|
|
275
|
+
)
|
|
276
|
+
})}
|
|
277
|
+
</InfiniteLoading>
|
|
278
|
+
</ul>
|
|
279
|
+
</Cell>
|
|
280
|
+
</>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
export default Demo3
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### primary主题
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { Cell, InfiniteLoading } from '@mijadesign/mjui-react-taro'
|
|
292
|
+
import React, { CSSProperties, useEffect, useState } from 'react'
|
|
293
|
+
|
|
294
|
+
const sleep = (time: number): Promise<unknown> =>
|
|
295
|
+
new Promise((resolve) => {
|
|
296
|
+
setTimeout(resolve, time)
|
|
297
|
+
})
|
|
298
|
+
const InfiniteUlStyle: CSSProperties = {
|
|
299
|
+
height: '300px',
|
|
300
|
+
width: '100%',
|
|
301
|
+
padding: '0',
|
|
302
|
+
overflowY: 'auto',
|
|
303
|
+
overflowX: 'hidden',
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const InfiniteLiStyle: CSSProperties = {
|
|
307
|
+
margin: '10px 10px 0',
|
|
308
|
+
fontSize: '14px',
|
|
309
|
+
color: 'rgba(100, 100, 100, 1)',
|
|
310
|
+
textAlign: 'center',
|
|
311
|
+
backgroundColor: '#FFF',
|
|
312
|
+
}
|
|
313
|
+
const Demo4 = () => {
|
|
314
|
+
const [customList, setCustomList] = useState<string[]>([])
|
|
315
|
+
const [customHasMore, setCustomHasMore] = useState(true)
|
|
316
|
+
|
|
317
|
+
useEffect(() => {
|
|
318
|
+
init()
|
|
319
|
+
}, [])
|
|
320
|
+
|
|
321
|
+
const init = () => {
|
|
322
|
+
for (let i = 0; i < 10; i++) {
|
|
323
|
+
customList.push(`${i}`)
|
|
324
|
+
}
|
|
325
|
+
setCustomList([...customList])
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const customLoadMore = async () => {
|
|
329
|
+
await sleep(2000)
|
|
330
|
+
const curLen = customList.length
|
|
331
|
+
for (let i = curLen; i < curLen + 10; i++) {
|
|
332
|
+
customList.push(`${i}`)
|
|
333
|
+
}
|
|
334
|
+
if (customList.length >= 30) {
|
|
335
|
+
setCustomHasMore(false)
|
|
336
|
+
} else {
|
|
337
|
+
setCustomList([...customList])
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return (
|
|
342
|
+
<>
|
|
343
|
+
<Cell>
|
|
344
|
+
<ul id="primaryScroll" style={InfiniteUlStyle}>
|
|
345
|
+
<InfiniteLoading
|
|
346
|
+
target="primaryScroll"
|
|
347
|
+
type="primary"
|
|
348
|
+
loadingText={<>加载中</>}
|
|
349
|
+
loadMoreText={<>没有更多了</>}
|
|
350
|
+
hasMore={customHasMore}
|
|
351
|
+
onLoadMore={customLoadMore}
|
|
352
|
+
>
|
|
353
|
+
{customList.map((item, index) => {
|
|
354
|
+
return (
|
|
355
|
+
<li key={index} style={InfiniteLiStyle}>
|
|
356
|
+
{item}
|
|
357
|
+
</li>
|
|
358
|
+
)
|
|
359
|
+
})}
|
|
360
|
+
</InfiniteLoading>
|
|
361
|
+
</ul>
|
|
362
|
+
</Cell>
|
|
363
|
+
</>
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
export default Demo4
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## InfiniteLoading
|
|
371
|
+
|
|
372
|
+
### Props
|
|
373
|
+
|
|
374
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
375
|
+
| --- | --- | --- | --- |
|
|
376
|
+
| type | 主题类型 | `default`\| `primary` | `default` |
|
|
377
|
+
| hasMore | 是否还有更多数据 | `boolean` | `true` |
|
|
378
|
+
| threshold | 距离底部多远加载 | `number` | `200` |
|
|
379
|
+
| target | 获取监听的目标元素 | `string` | `-` |
|
|
380
|
+
| loadMoreText | “没有更多数据”展示文案 | `string` | `哎呀,这里是底部了啦` |
|
|
381
|
+
| pullRefresh | 是否开启下拉刷新 | `boolean` | `false` |
|
|
382
|
+
| pullingText | 下拉刷新提示文案 | `ReactNode` | `松手刷新` |
|
|
383
|
+
| loadingText | 上拉加载提示文案 | `ReactNode` | `刷新中` |
|
|
384
|
+
| onRefresh | 下拉刷新事件回调 | `() => Promise<void>` | `-` |
|
|
385
|
+
| onLoadMore | 继续加载的回调函数 | `() => Promise<void>` | `-` |
|
|
386
|
+
| onScroll | 实时监听滚动高度 | `(param: number) => void` | `-` |
|
|
387
|
+
|
|
388
|
+
## 主题定制
|
|
389
|
+
|
|
390
|
+
### 样式变量
|
|
391
|
+
|
|
392
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
393
|
+
|
|
394
|
+
| 名称 | 说明 | 默认值 |
|
|
395
|
+
| --- | --- | --- |
|
|
396
|
+
| \--nutui-infiniteloading-color | 滑动到底部的文字颜色 | `$color-text-help` |
|
|
397
|
+
| \--nutui-infiniteloading-icon-size | 滑动到底部的文字颜色 | `24px` |
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 8
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/feedback/pages/noticebar/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 操作反馈
|
|
6
|
+
order: 6
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# NoticeBar 公告栏 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
用于循环播放展示一组消息通知。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { NoticeBar } from '@mijadesign/mjui-react-taro';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { NoticeBar } from '@mijadesign/mjui-react-taro'
|
|
27
|
+
import { ConfigProvider } from '@nutui/nutui-react-taro'
|
|
28
|
+
import React from 'react'
|
|
29
|
+
|
|
30
|
+
const Demo1 = () => {
|
|
31
|
+
const text = '商保理赔结果已出,请就诊人确认'
|
|
32
|
+
const styles = { padding: '12px 0', fontSize: '13px', fontWeight: 'normal', marginLeft: '16px' }
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<h2 style={styles}>纯文字的公告栏</h2>
|
|
36
|
+
<NoticeBar content={text} leftIcon={null} scrollable={false} />
|
|
37
|
+
<h2 style={styles}>带图标的公告栏</h2>
|
|
38
|
+
<NoticeBar content={text} scrollable={false} />
|
|
39
|
+
<h2 style={styles}>带关闭的公告栏</h2>
|
|
40
|
+
<NoticeBar content={text} scrollable={false} closeable />
|
|
41
|
+
<h2 style={styles}>自定义样式的公告栏</h2>
|
|
42
|
+
<ConfigProvider
|
|
43
|
+
theme={{
|
|
44
|
+
nutuiNoticebarBackground: '#F8F8F8',
|
|
45
|
+
nutuiNoticebarColor: '#0D0D0D',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<NoticeBar content={text} scrollable={false} closeable />
|
|
49
|
+
</ConfigProvider>
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
export default Demo1
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### 居中布局,不支持滚动
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import React from 'react'
|
|
63
|
+
import { NoticeBar, Space } from '@mijadesign/mjui-react-taro'
|
|
64
|
+
|
|
65
|
+
const Demo2 = () => {
|
|
66
|
+
return (
|
|
67
|
+
<Space direction="vertical">
|
|
68
|
+
<NoticeBar content="认证失败,商保认证不通过认证失败" leftIcon={null} scrollable={false} type="danger" />
|
|
69
|
+
<NoticeBar content="保险公司认证中,请稍等" leftIcon={null} scrollable={false} type="warning" />
|
|
70
|
+
<NoticeBar content="认证通过,等待治疗完成后进入理赔处理" leftIcon={null} scrollable={false} type="success" />
|
|
71
|
+
<NoticeBar content="商保理赔结果已出,请就诊人确认" leftIcon={null} scrollable={false} />
|
|
72
|
+
</Space>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
export default Demo2
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### 滚动播放
|
|
81
|
+
|
|
82
|
+
通知栏的内容长度溢出时会自动开启滚动播放,可通过 scrollable 属性可以控制该行为
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import React from 'react'
|
|
87
|
+
import { NoticeBar, Space } from '@mijadesign/mjui-react-taro'
|
|
88
|
+
|
|
89
|
+
const Demo3 = () => {
|
|
90
|
+
const text = '商保理赔结果已出,请就诊人确认商保理赔结果已出,请就诊人确认商保理赔结果已出,请就诊人确认'
|
|
91
|
+
const textShort = '商保理赔结果已出,请就诊人确认商保理赔结果已出,请就诊人确认'
|
|
92
|
+
return (
|
|
93
|
+
<Space direction="vertical">
|
|
94
|
+
<NoticeBar content={textShort} leftIcon={null} wrap />
|
|
95
|
+
<NoticeBar content={text} closeable wrap />
|
|
96
|
+
<NoticeBar content={text} wrap />
|
|
97
|
+
</Space>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
export default Demo3
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 关闭模式
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import React from 'react'
|
|
109
|
+
import { NoticeBar } from '@mijadesign/mjui-react-taro'
|
|
110
|
+
|
|
111
|
+
const Demo4 = () => {
|
|
112
|
+
const text = '商保理赔结果已出,请就诊人确认'
|
|
113
|
+
return <NoticeBar scrollable>{text}</NoticeBar>
|
|
114
|
+
}
|
|
115
|
+
export default Demo4
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## NoticeBar
|
|
120
|
+
|
|
121
|
+
### Props
|
|
122
|
+
|
|
123
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
124
|
+
| --- | --- | --- | --- |
|
|
125
|
+
| align | 布局方式, 值为`center`时,不支持滚动 | `left` \| `center` | `left` |
|
|
126
|
+
| direction | 滚动的方向,可选 horizontal、vertical | `string` | `horizontal` |
|
|
127
|
+
| content | 提示的信息 | `string` | `-` |
|
|
128
|
+
| closeable | 是否启用关闭模式 | `boolean` | `false` |
|
|
129
|
+
| leftIcon | 左边的 icon,closeable 模式下默认为空 | `ReactNode` | `-` |
|
|
130
|
+
| rightIcon | closeable 模式下,默认为 `<Close />` | `ReactNode` | `-` |
|
|
131
|
+
| right | 区别于rightIcon,为右边自定义区域,仅用于 direction='horizontal' 模式 | `ReactNode` | `-` |
|
|
132
|
+
| delay | 延时多少秒 | `string` \| `number` | `1` |
|
|
133
|
+
| scrollable | 是否可以滚动 | `boolean` | `true` |
|
|
134
|
+
| speed | 滚动速率 (px/s) | `number` | `50` |
|
|
135
|
+
| wrap | 是否开启文本换行 | `boolean` | `false` |
|
|
136
|
+
| onClick | 外层点击事件回调 | `(event: any) => void` | `-` |
|
|
137
|
+
| onClose | 关闭通知栏时触发 | `(event: any) => void` | `-` |
|
|
138
|
+
| onItemClick | 垂直滚动多条数据时,点击当前展示的信息时触发 | `(event: any, value: any) => void` | `-` |
|
|
139
|
+
| type | 公告栏类型 | `primary` \| `success` \| `danger` \| `warning` | `primary` |
|
|
140
|
+
|
|
141
|
+
### Props(direction=vertical)
|
|
142
|
+
|
|
143
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
144
|
+
| --- | --- | --- | --- |
|
|
145
|
+
| list | 纵向滚动数据列表 | `Array` | `[]` |
|
|
146
|
+
| speed | 滚动的速度 | `number` | `50` |
|
|
147
|
+
| duration | 停留时间(毫秒) | `number` | `1000` |
|
|
148
|
+
| height | 每一个滚动列的高度(px) | `number` | `40` |
|
|
149
|
+
| closeable | 是否启用右侧关闭图标,可以通过 rightIcon 自定义图标 | `boolean` | `false` |
|
|
150
|
+
|
|
151
|
+
## 主题定制
|
|
152
|
+
|
|
153
|
+
### 样式变量
|
|
154
|
+
|
|
155
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
156
|
+
|
|
157
|
+
| 名称 | 说明 | 默认值 |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| \--nutui-noticebar-background | 背景色 | `$color-primary-background` |
|
|
160
|
+
| \--nutui-noticebar-border-radius | 圆角 | `0` |
|
|
161
|
+
| \--nutui-noticebar-box-padding | padding值 | `0 $spacing-3` |
|
|
162
|
+
| \--nutui-noticebar-color | 文字色 | `$color-primary` |
|
|
163
|
+
| \--nutui-noticebar-error-background | error 的背景色 | `$color-danger-background` |
|
|
164
|
+
| \--nutui-noticebar-error-color | error 的文字色 | `$color-danger` |
|
|
165
|
+
| \--nutui-noticebar-font-size | 字号 | `$font-size-2` |
|
|
166
|
+
| \--nutui-noticebar-height | 高度 | `40px` |
|
|
167
|
+
| \--nutui-noticebar-icon-gap | icon、text间距 | `$spacing-1` |
|
|
168
|
+
| \--nutui-noticebar-left-icon-width | 左侧icon的宽度和高度的设定 | `20px` |
|
|
169
|
+
| \--nutui-noticebar-line-height | 行高 | `24px` |
|
|
170
|
+
| \--nutui-noticebar-right-icon-width | 右侧icon的宽度和高度的设定 | `20px` |
|
|
171
|
+
| \--nutui-noticebar-success-background | success 的背景色 | `$color-success-background` |
|
|
172
|
+
| \--nutui-noticebar-success-color | success 的文字色 | `$color-success` |
|
|
173
|
+
| \--nutui-noticebar-warning-background | warning 的背景色 | `$color-warning-background` |
|
|
174
|
+
| \--nutui-noticebar-warning-color | warning 的文字色 | `$color-warning` |
|
|
175
|
+
| \--nutui-noticebar-wrapable-padding | 多行展示的padding值 | `$spacing-2` |
|