@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,385 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 18
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/exhibition/pages/swiper/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 展示组件
|
|
6
|
+
order: 7
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Swiper 轮播 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
常用于一组图片或卡片轮播,当内容空间不足时,可以用走马灯的形式进行收纳,进行轮播展现。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Swiper } from '@mijadesign/mjui-react-taro';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
27
|
+
import Taro from '@tarojs/taro'
|
|
28
|
+
import React from 'react'
|
|
29
|
+
|
|
30
|
+
const list = [
|
|
31
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner01.png',
|
|
32
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner02.png',
|
|
33
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner03.png',
|
|
34
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner04.png',
|
|
35
|
+
]
|
|
36
|
+
const Demo1 = () => {
|
|
37
|
+
return (
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
<Swiper defaultValue={1} autoPlay indicator height={Taro.pxTransform(72)}>
|
|
40
|
+
{list.map((item, index) => (
|
|
41
|
+
<Swiper.Item key={item}>
|
|
42
|
+
<img width="100%" height="100%" onClick={() => console.log(index)} src={item} alt="" />
|
|
43
|
+
</Swiper.Item>
|
|
44
|
+
))}
|
|
45
|
+
</Swiper>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
export default Demo1
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 异步加载
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import React, { useEffect, useState } from 'react'
|
|
57
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
58
|
+
import Taro from '@tarojs/taro'
|
|
59
|
+
|
|
60
|
+
const Demo2 = () => {
|
|
61
|
+
const list = [
|
|
62
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner01.png',
|
|
63
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner02.png',
|
|
64
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner03.png',
|
|
65
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner04.png',
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
const [asyncList, setAsyncList] = useState<string[]>([])
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
setAsyncList(list)
|
|
72
|
+
}, 3000)
|
|
73
|
+
}, [])
|
|
74
|
+
return (
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
<Swiper defaultValue={0} indicator height={Taro.pxTransform(72)} width={Taro.pxTransform(343)}>
|
|
77
|
+
{asyncList.map((item, index) => (
|
|
78
|
+
<Swiper.Item key={item}>
|
|
79
|
+
<img width="100%" height="100%" src={item} alt="" />
|
|
80
|
+
</Swiper.Item>
|
|
81
|
+
))}
|
|
82
|
+
</Swiper>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
export default Demo2
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 自定义大小
|
|
90
|
+
|
|
91
|
+
`width` 自定义轮播大小
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import React from 'react'
|
|
96
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
97
|
+
import Taro from '@tarojs/taro'
|
|
98
|
+
|
|
99
|
+
const Demo3 = () => {
|
|
100
|
+
const list = [
|
|
101
|
+
'https://sblp-oss.mibaodata.com/static/front-end/home/homeBanner.png',
|
|
102
|
+
'https://sblp-oss.mibaodata.com/static/front-end/home/homeBanner.png',
|
|
103
|
+
'https://sblp-oss.mibaodata.com/static/front-end/home/homeBanner.png',
|
|
104
|
+
'https://sblp-oss.mibaodata.com/static/front-end/home/homeBanner.png',
|
|
105
|
+
]
|
|
106
|
+
return (
|
|
107
|
+
<Swiper
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
width={Taro.pxTransform(343)}
|
|
110
|
+
height={Taro.pxTransform(145)}
|
|
111
|
+
defaultValue={0}
|
|
112
|
+
indicator
|
|
113
|
+
style={{ margin: '0 auto' }}
|
|
114
|
+
>
|
|
115
|
+
{list.map((item) => (
|
|
116
|
+
<Swiper.Item key={item}>
|
|
117
|
+
<img width="100%" height="100%" src={item} alt="" />
|
|
118
|
+
</Swiper.Item>
|
|
119
|
+
))}
|
|
120
|
+
</Swiper>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
export default Demo3
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 自定义分页指示器
|
|
128
|
+
|
|
129
|
+
`pageContent` 表示自定义指示器
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import React, { useState } from 'react'
|
|
134
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
135
|
+
import Taro from '@tarojs/taro'
|
|
136
|
+
|
|
137
|
+
const Demo4 = () => {
|
|
138
|
+
const [current, setCurrent] = useState(0)
|
|
139
|
+
const list = [
|
|
140
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner01.png',
|
|
141
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner02.png',
|
|
142
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner03.png',
|
|
143
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner04.png',
|
|
144
|
+
]
|
|
145
|
+
return (
|
|
146
|
+
<Swiper
|
|
147
|
+
defaultValue={0}
|
|
148
|
+
onChange={(e) => {
|
|
149
|
+
setCurrent(e.detail.current)
|
|
150
|
+
}}
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
width={Taro.pxTransform(343)}
|
|
153
|
+
height={Taro.pxTransform(72)}
|
|
154
|
+
indicator={
|
|
155
|
+
<div
|
|
156
|
+
style={{
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
bottom: '6px',
|
|
159
|
+
left: '50%',
|
|
160
|
+
width: '36px',
|
|
161
|
+
height: '19px',
|
|
162
|
+
background: 'rgba(0, 0, 0, 0.4)',
|
|
163
|
+
borderRadius: '999px',
|
|
164
|
+
textAlign: 'center',
|
|
165
|
+
color: '#fff',
|
|
166
|
+
fontSize: '13px',
|
|
167
|
+
zIndex: '1',
|
|
168
|
+
transform: 'translateX(-50%)',
|
|
169
|
+
lineHeight: '19px',
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
{current + 1}/{list.length}
|
|
173
|
+
</div>
|
|
174
|
+
}
|
|
175
|
+
>
|
|
176
|
+
{list.map((item) => (
|
|
177
|
+
<Swiper.Item key={item}>
|
|
178
|
+
<img width="100%" height="100%" src={item} alt="" />
|
|
179
|
+
</Swiper.Item>
|
|
180
|
+
))}
|
|
181
|
+
</Swiper>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
export default Demo4
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 手动切换
|
|
189
|
+
|
|
190
|
+
可通过 `API`(`prev`,`next`)进行手动切换
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import React, { useState } from 'react'
|
|
195
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
196
|
+
import { ArrowLeft, ArrowRight } from '@nutui/icons-react-taro'
|
|
197
|
+
import Taro from '@tarojs/taro'
|
|
198
|
+
|
|
199
|
+
const Demo5 = () => {
|
|
200
|
+
const swiperRef = React.useRef<any>(null)
|
|
201
|
+
const [current2, setCurrent2] = useState(0)
|
|
202
|
+
|
|
203
|
+
const list = [
|
|
204
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner01.png',
|
|
205
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner02.png',
|
|
206
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner03.png',
|
|
207
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner04.png',
|
|
208
|
+
]
|
|
209
|
+
const btnsStyle = {
|
|
210
|
+
width: '100%',
|
|
211
|
+
position: 'absolute',
|
|
212
|
+
top: '50%',
|
|
213
|
+
transform: 'translateY(-14px)',
|
|
214
|
+
zIndex: 1,
|
|
215
|
+
display: 'flex',
|
|
216
|
+
justifyContent: 'space-between',
|
|
217
|
+
height: '0px',
|
|
218
|
+
}
|
|
219
|
+
const spanStyle = {
|
|
220
|
+
display: 'flex',
|
|
221
|
+
alignItems: 'center',
|
|
222
|
+
justifyContent: 'center',
|
|
223
|
+
width: '20px',
|
|
224
|
+
height: '28px',
|
|
225
|
+
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
226
|
+
}
|
|
227
|
+
return (
|
|
228
|
+
<div
|
|
229
|
+
className="demo-box"
|
|
230
|
+
style={{ width: Taro.pxTransform(343), height: Taro.pxTransform(72), position: 'relative' }}
|
|
231
|
+
>
|
|
232
|
+
<Swiper
|
|
233
|
+
ref={swiperRef}
|
|
234
|
+
defaultValue={0}
|
|
235
|
+
onChange={(e) => {
|
|
236
|
+
setCurrent2(e.detail.current)
|
|
237
|
+
}}
|
|
238
|
+
indicator={
|
|
239
|
+
<div className="page">
|
|
240
|
+
{current2 + 1}/{list.length}
|
|
241
|
+
</div>
|
|
242
|
+
}
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
width={Taro.pxTransform(343)}
|
|
245
|
+
height={Taro.pxTransform(72)}
|
|
246
|
+
>
|
|
247
|
+
{list.map((item) => {
|
|
248
|
+
return (
|
|
249
|
+
<Swiper.Item key={item}>
|
|
250
|
+
<img src={item} alt="" style={{ width: '100%', height: '100%' }} draggable={false} />
|
|
251
|
+
</Swiper.Item>
|
|
252
|
+
)
|
|
253
|
+
})}
|
|
254
|
+
</Swiper>
|
|
255
|
+
<div style={btnsStyle as any}>
|
|
256
|
+
<span style={spanStyle} onClick={(e) => swiperRef.current?.prev()}>
|
|
257
|
+
<ArrowLeft size={20} color="#fff" />
|
|
258
|
+
</span>
|
|
259
|
+
<span style={spanStyle} onClick={(e) => swiperRef.current?.next()}>
|
|
260
|
+
<ArrowRight size={20} color="#fff" />
|
|
261
|
+
</span>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
export default Demo5
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### 垂直方向
|
|
271
|
+
|
|
272
|
+
`direction` 自定义轮播方向
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import React from 'react'
|
|
277
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
278
|
+
import Taro from '@tarojs/taro'
|
|
279
|
+
|
|
280
|
+
const Demo6 = () => {
|
|
281
|
+
const list = [
|
|
282
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner01.png',
|
|
283
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner02.png',
|
|
284
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner03.png',
|
|
285
|
+
'https://sblp-oss.mibaodata.com/static/env_prod/banner04.png',
|
|
286
|
+
]
|
|
287
|
+
return (
|
|
288
|
+
<Swiper
|
|
289
|
+
defaultValue={0}
|
|
290
|
+
direction="vertical"
|
|
291
|
+
indicator
|
|
292
|
+
// @ts-ignore
|
|
293
|
+
width={Taro.pxTransform(343)}
|
|
294
|
+
height={Taro.pxTransform(72)}
|
|
295
|
+
>
|
|
296
|
+
{list.map((item) => (
|
|
297
|
+
<Swiper.Item key={item}>
|
|
298
|
+
<img width="100%" height="100%" src={item} alt="" />
|
|
299
|
+
</Swiper.Item>
|
|
300
|
+
))}
|
|
301
|
+
</Swiper>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
export default Demo6
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 一屏多个数据时
|
|
309
|
+
|
|
310
|
+
`center` 代表可居中,同时必须传 `height`
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
import React from 'react'
|
|
315
|
+
import { Swiper } from '@mijadesign/mjui-react-taro'
|
|
316
|
+
|
|
317
|
+
const Demo9 = () => {
|
|
318
|
+
return (
|
|
319
|
+
<Swiper loop autoPlay>
|
|
320
|
+
<Swiper.Item>
|
|
321
|
+
<div style={{ display: 'flex' }}>
|
|
322
|
+
<div style={{ flex: '1', border: '1 red' }}>Item1</div>
|
|
323
|
+
<div style={{ flex: '1', border: '1 red' }}>Item2</div>
|
|
324
|
+
<div style={{ flex: '1', border: '1 red' }}>Item3</div>
|
|
325
|
+
<div style={{ flex: '1', border: '1 red' }}>Item4</div>
|
|
326
|
+
</div>
|
|
327
|
+
</Swiper.Item>
|
|
328
|
+
<Swiper.Item>
|
|
329
|
+
<div style={{ display: 'flex' }}>
|
|
330
|
+
<div style={{ flex: '1', border: '1 red' }}>Item5</div>
|
|
331
|
+
<div style={{ flex: '1', border: '1 red' }}>Item6</div>
|
|
332
|
+
<div style={{ flex: '1', border: '1 red' }}>Item7</div>
|
|
333
|
+
<div style={{ flex: '1', border: '1 red' }}>Item8</div>
|
|
334
|
+
</div>
|
|
335
|
+
</Swiper.Item>
|
|
336
|
+
<Swiper.Item>
|
|
337
|
+
<div style={{ display: 'flex' }}>
|
|
338
|
+
<div style={{ flex: '1', border: '1 red' }}>Item9</div>
|
|
339
|
+
<div style={{ flex: '1', border: '1 red' }}>Item10</div>
|
|
340
|
+
<div style={{ flex: '1', border: '1 red' }}>Item11</div>
|
|
341
|
+
<div style={{ flex: '1', border: '1 red' }}>Item12</div>
|
|
342
|
+
</div>
|
|
343
|
+
</Swiper.Item>
|
|
344
|
+
</Swiper>
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
export default Demo9
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Swiper
|
|
352
|
+
|
|
353
|
+
### Props
|
|
354
|
+
|
|
355
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
356
|
+
| --- | --- | --- | --- |
|
|
357
|
+
| width | 轮播卡片的宽度 | `number` | `-` |
|
|
358
|
+
| height | 轮播卡片的高度 | `number` | `-` |
|
|
359
|
+
| direction | 轮播方向 | `horizontal` \| `vertical` | `horizontal` |
|
|
360
|
+
| indicator | 分页指示器是否展示 | `boolean` | `false` |
|
|
361
|
+
| loop | 是否循环轮播 | `boolean` | `true` |
|
|
362
|
+
| autoPlay | 自动轮播 | `boolean` | `false` |
|
|
363
|
+
| defaultValue | 初始化索引值 | `number` | `0` |
|
|
364
|
+
| onChange | 卡片切换后的回调 | `(current: number) => void` | `-` |
|
|
365
|
+
|
|
366
|
+
> Swiper 是对 Taro Swiper 进行的封装,可以支持 Taro Swiper 属性的透传。具体支持属性可参考[https://taro-docs.jd.com/docs/components/viewContainer/swiper](https://taro-docs.jd.com/docs/components/viewContainer/swiper)
|
|
367
|
+
|
|
368
|
+
### Ref
|
|
369
|
+
|
|
370
|
+
| 属性 | 说明 | 类型 |
|
|
371
|
+
| --- | --- | --- |
|
|
372
|
+
| prev | 切换到上一页 | `()=>void` |
|
|
373
|
+
| next | 切换到下一页 | `()=>void` |
|
|
374
|
+
| to | 切换到指定轮播 | `(index: number)=>void` |
|
|
375
|
+
|
|
376
|
+
## 主题定制
|
|
377
|
+
|
|
378
|
+
### 样式变量
|
|
379
|
+
|
|
380
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
381
|
+
|
|
382
|
+
| 名称 | 说明 | 默认值 |
|
|
383
|
+
| --- | --- | --- |
|
|
384
|
+
| \--nutui-swiper-pagination-bottom | 分页器距离底部的距离 | `12px` |
|
|
385
|
+
| \--nutui-swiper-indicator-bottom | 指示器距离底部的距离 | `12px` |
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 21
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/exhibition/pages/tag/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 展示组件
|
|
6
|
+
order: 7
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Tag 标签 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
用于标记和分类的标签。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Tag } from '@mijadesign/mjui-react-taro';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 代码实例
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Cell, Tag } from '@mijadesign/mjui-react-taro'
|
|
27
|
+
import React from 'react'
|
|
28
|
+
|
|
29
|
+
const Demo1 = () => {
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<Cell.Group>
|
|
33
|
+
<Cell
|
|
34
|
+
title="填充"
|
|
35
|
+
extra={
|
|
36
|
+
<Tag type="primary" mode="fill">
|
|
37
|
+
主要
|
|
38
|
+
</Tag>
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
<Cell
|
|
42
|
+
title="描边"
|
|
43
|
+
extra={
|
|
44
|
+
<Tag type="primary" mode="plain">
|
|
45
|
+
主要
|
|
46
|
+
</Tag>
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
</Cell.Group>
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
export default Demo1
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 样式风格
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { Cell, Tag } from '@mijadesign/mjui-react-taro'
|
|
62
|
+
import React from 'react'
|
|
63
|
+
|
|
64
|
+
const Demo2 = () => {
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<Cell.Group>
|
|
68
|
+
<Cell title="方形" extra={<Tag mode="fill">主要</Tag>} />
|
|
69
|
+
<Cell
|
|
70
|
+
title="圆角"
|
|
71
|
+
extra={
|
|
72
|
+
<Tag mode="fill" round>
|
|
73
|
+
主要
|
|
74
|
+
</Tag>
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
{/* <Cell
|
|
78
|
+
title="可关闭"
|
|
79
|
+
extra={
|
|
80
|
+
<Space>
|
|
81
|
+
<Tag mode="fill" closeable>
|
|
82
|
+
主要
|
|
83
|
+
</Tag>
|
|
84
|
+
<Tag closeable>主要</Tag>
|
|
85
|
+
</Space>
|
|
86
|
+
}
|
|
87
|
+
/> */}
|
|
88
|
+
</Cell.Group>
|
|
89
|
+
</>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
export default Demo2
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 自定义颜色
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { Cell, Tag } from '@mijadesign/mjui-react-taro'
|
|
101
|
+
import React from 'react'
|
|
102
|
+
|
|
103
|
+
const Demo3 = () => {
|
|
104
|
+
return (
|
|
105
|
+
<Cell.Group>
|
|
106
|
+
<Cell title="大尺寸" extra={<Tag mode="fill">大标签</Tag>} />
|
|
107
|
+
<Cell
|
|
108
|
+
title="小尺寸"
|
|
109
|
+
extra={
|
|
110
|
+
<Tag mode="fill" size="small">
|
|
111
|
+
小标签
|
|
112
|
+
</Tag>
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
</Cell.Group>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
export default Demo3
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 图文
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { Cell, Space, Tag } from '@mijadesign/mjui-react-taro'
|
|
127
|
+
import React from 'react'
|
|
128
|
+
|
|
129
|
+
const Demo4 = () => {
|
|
130
|
+
return (
|
|
131
|
+
<>
|
|
132
|
+
<Cell.Group>
|
|
133
|
+
<Cell
|
|
134
|
+
title="主要"
|
|
135
|
+
extra={
|
|
136
|
+
<Space>
|
|
137
|
+
<Tag mode="fill">标签</Tag>
|
|
138
|
+
<Tag>标签</Tag>
|
|
139
|
+
<Tag mode="plain">标签</Tag>
|
|
140
|
+
</Space>
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
<Cell
|
|
144
|
+
title="成功"
|
|
145
|
+
extra={
|
|
146
|
+
<Space>
|
|
147
|
+
<Tag type="success" mode="fill">
|
|
148
|
+
标签
|
|
149
|
+
</Tag>
|
|
150
|
+
<Tag type="success">标签</Tag>
|
|
151
|
+
<Tag type="success" mode="plain">
|
|
152
|
+
标签
|
|
153
|
+
</Tag>
|
|
154
|
+
</Space>
|
|
155
|
+
}
|
|
156
|
+
/>
|
|
157
|
+
<Cell
|
|
158
|
+
title="错误"
|
|
159
|
+
extra={
|
|
160
|
+
<Space>
|
|
161
|
+
<Tag type="danger" mode="fill">
|
|
162
|
+
标签
|
|
163
|
+
</Tag>
|
|
164
|
+
<Tag type="danger">标签</Tag>
|
|
165
|
+
<Tag type="danger" mode="plain">
|
|
166
|
+
标签
|
|
167
|
+
</Tag>
|
|
168
|
+
</Space>
|
|
169
|
+
}
|
|
170
|
+
/>
|
|
171
|
+
<Cell
|
|
172
|
+
title="警示"
|
|
173
|
+
extra={
|
|
174
|
+
<Space>
|
|
175
|
+
<Tag type="warning" mode="fill">
|
|
176
|
+
标签
|
|
177
|
+
</Tag>
|
|
178
|
+
<Tag type="warning">标签</Tag>
|
|
179
|
+
<Tag type="warning" mode="plain">
|
|
180
|
+
标签
|
|
181
|
+
</Tag>
|
|
182
|
+
</Space>
|
|
183
|
+
}
|
|
184
|
+
/>
|
|
185
|
+
<Cell
|
|
186
|
+
title="默认"
|
|
187
|
+
extra={
|
|
188
|
+
<Space>
|
|
189
|
+
<Tag type="default" mode="fill">
|
|
190
|
+
标签
|
|
191
|
+
</Tag>
|
|
192
|
+
<Tag type="default">标签</Tag>
|
|
193
|
+
<Tag type="default" mode="plain">
|
|
194
|
+
标签
|
|
195
|
+
</Tag>
|
|
196
|
+
</Space>
|
|
197
|
+
}
|
|
198
|
+
/>
|
|
199
|
+
</Cell.Group>
|
|
200
|
+
</>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
export default Demo4
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Tag
|
|
208
|
+
|
|
209
|
+
### Props
|
|
210
|
+
|
|
211
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
212
|
+
| --- | --- | --- | --- |
|
|
213
|
+
| type | 标签类型 | `primary` \| `default` \| `info` \| `success` \| `danger` \| `warning` | `primary` |
|
|
214
|
+
| size | 标签大小 | `default` \| `small` | `default` |
|
|
215
|
+
| mode | 标签模式 | `plain` \| `fill` \| `default` | `default` |
|
|
216
|
+
| background | 标签颜色 | `string` | `-` |
|
|
217
|
+
| color | 文本颜色,优先级高于color属性 | `string` | `-` |
|
|
218
|
+
| round | 是否为圆角样式 | `boolean` | `false` |
|
|
219
|
+
| mark | 是否为标记样式 | `boolean` | `false` |
|
|
220
|
+
| closeable | 是否为可关闭标签 | `boolean` | `false` |
|
|
221
|
+
| closeIcon | 关闭按钮 | `ReactNode` | `<Failure>` |
|
|
222
|
+
| onClick | 点击事件 | `(e: MouseEvent) => void` | `-` |
|
|
223
|
+
| onClose | 关闭事件 | `(e?: any) => void` | `-` |
|
|
224
|
+
|
|
225
|
+
## 主题定制
|
|
226
|
+
|
|
227
|
+
### 样式变量
|
|
228
|
+
|
|
229
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
230
|
+
|
|
231
|
+
| 名称 | 说明 | 默认值 |
|
|
232
|
+
| --- | --- | --- |
|
|
233
|
+
| \--nutui-tag-background-color | 背景色 | `$color-border` |
|
|
234
|
+
| \--nutui-tag-border-radius | 圆角 | `$radius-0` |
|
|
235
|
+
| \--nutui-tag-border-width | 边宽 | `1px` |
|
|
236
|
+
| \--nutui-tag-color | 字色 | `$color-text-disabled` |
|
|
237
|
+
| \--nutui-tag-danger-background-color | 危险背景色 | `$color-error-background` |
|
|
238
|
+
| \--nutui-tag-danger-color | 危险字色 | `$color-error` |
|
|
239
|
+
| \--nutui-tag-font-size | 字号 | `$font-size-0` |
|
|
240
|
+
| \--nutui-tag-height | 圆角 | `20px` |
|
|
241
|
+
| \--nutui-tag-info-background-color | 信息背景色 | `$color-info` |
|
|
242
|
+
| \--nutui-tag-large-border-radius | 圆角 | `$radius-1` |
|
|
243
|
+
| \--nutui-tag-large-font-size | 圆角 | `$font-size-1` |
|
|
244
|
+
| \--nutui-tag-large-height | 圆角 | `24px` |
|
|
245
|
+
| \--nutui-tag-mark-border-radius | mark模式下的圆角 | `0 8px 8px 0` |
|
|
246
|
+
| \--nutui-tag-padding | padding 值 | `0 $spacing-1` |
|
|
247
|
+
| \--nutui-tag-primary-background-color | 主色背景色 | `$color-primary-background` |
|
|
248
|
+
| \--nutui-tag-primary-color | 主色字色 | `$color-primary` |
|
|
249
|
+
| \--nutui-tag-round-border-radius | round模式下的圆角 | `8px` |
|
|
250
|
+
| \--nutui-tag-success-background-color | 成功背景色 | `$color-success-background` |
|
|
251
|
+
| \--nutui-tag-success-color | 成功字色 | `$color-success` |
|
|
252
|
+
| \--nutui-tag-warning-background-color | 警告背景色 | `$color-warning-background` |
|
|
253
|
+
| \--nutui-tag-warning-color | 警告字色 | `$color-warning` |
|