@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,563 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 11
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/feedback/pages/popup/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 操作反馈
|
|
6
|
+
order: 6
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Popup 弹出层 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
弹出层容器,用于展示弹窗、信息提示等内容
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Popup } from '@mijadesign/mjui-react-taro'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 示例代码
|
|
20
|
+
|
|
21
|
+
### 基础用法
|
|
22
|
+
|
|
23
|
+
`visible` 控制显示/隐藏
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Button, Cell, Popup } from '@mijadesign/mjui-react-taro'
|
|
28
|
+
import { View } from '@tarojs/components'
|
|
29
|
+
import React, { useState } from 'react'
|
|
30
|
+
|
|
31
|
+
const Demo1 = () => {
|
|
32
|
+
const [showBasic, setShowBasic] = useState(false)
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<Button
|
|
36
|
+
onClick={() => {
|
|
37
|
+
setShowBasic(true)
|
|
38
|
+
}}
|
|
39
|
+
fill="outline"
|
|
40
|
+
block
|
|
41
|
+
>
|
|
42
|
+
展示弹出层
|
|
43
|
+
</Button>
|
|
44
|
+
<Popup
|
|
45
|
+
visible={showBasic}
|
|
46
|
+
style={{ padding: '30px 50px' }}
|
|
47
|
+
onClose={() => {
|
|
48
|
+
setShowBasic(false)
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<View style={{ height: '200px', overflowY: 'scroll' }}>
|
|
52
|
+
{Array.from({ length: 20 })
|
|
53
|
+
.fill('')
|
|
54
|
+
.map((_, i) => (
|
|
55
|
+
<Cell key={i}>
|
|
56
|
+
<View>正文</View>
|
|
57
|
+
</Cell>
|
|
58
|
+
))}
|
|
59
|
+
</View>
|
|
60
|
+
</Popup>
|
|
61
|
+
</>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
export default Demo1
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 弹出位置
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Button, Popup } from '@mijadesign/mjui-react-taro'
|
|
73
|
+
import React, { useState } from 'react'
|
|
74
|
+
|
|
75
|
+
const Demo2 = () => {
|
|
76
|
+
const [showCenter, setShowCenter] = useState(false)
|
|
77
|
+
const [showTop, setShowTop] = useState(false)
|
|
78
|
+
const [showBottom, setShowBottom] = useState(false)
|
|
79
|
+
const [showLeft, setShowLeft] = useState(false)
|
|
80
|
+
const [showRight, setShowRight] = useState(false)
|
|
81
|
+
|
|
82
|
+
const marginStyle = {
|
|
83
|
+
marginBottom: '12px',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<>
|
|
88
|
+
<Button
|
|
89
|
+
onClick={() => {
|
|
90
|
+
setShowCenter(true)
|
|
91
|
+
}}
|
|
92
|
+
type="primary"
|
|
93
|
+
fill="outline"
|
|
94
|
+
block
|
|
95
|
+
style={marginStyle}
|
|
96
|
+
>
|
|
97
|
+
中间弹出
|
|
98
|
+
</Button>
|
|
99
|
+
<Button
|
|
100
|
+
onClick={() => {
|
|
101
|
+
setShowTop(true)
|
|
102
|
+
}}
|
|
103
|
+
type="primary"
|
|
104
|
+
fill="outline"
|
|
105
|
+
block
|
|
106
|
+
style={marginStyle}
|
|
107
|
+
>
|
|
108
|
+
顶部弹出
|
|
109
|
+
</Button>
|
|
110
|
+
<Button
|
|
111
|
+
onClick={() => {
|
|
112
|
+
setShowBottom(true)
|
|
113
|
+
}}
|
|
114
|
+
type="primary"
|
|
115
|
+
fill="outline"
|
|
116
|
+
block
|
|
117
|
+
style={marginStyle}
|
|
118
|
+
>
|
|
119
|
+
底部弹出
|
|
120
|
+
</Button>
|
|
121
|
+
<Button
|
|
122
|
+
onClick={() => {
|
|
123
|
+
setShowLeft(true)
|
|
124
|
+
}}
|
|
125
|
+
type="primary"
|
|
126
|
+
fill="outline"
|
|
127
|
+
block
|
|
128
|
+
style={marginStyle}
|
|
129
|
+
>
|
|
130
|
+
左侧弹出
|
|
131
|
+
</Button>
|
|
132
|
+
<Button
|
|
133
|
+
onClick={() => {
|
|
134
|
+
setShowRight(true)
|
|
135
|
+
}}
|
|
136
|
+
type="primary"
|
|
137
|
+
fill="outline"
|
|
138
|
+
block
|
|
139
|
+
>
|
|
140
|
+
右侧弹出
|
|
141
|
+
</Button>
|
|
142
|
+
<Popup
|
|
143
|
+
visible={showCenter}
|
|
144
|
+
style={{ height: '260px', width: '260px' }}
|
|
145
|
+
onClose={() => {
|
|
146
|
+
setShowCenter(false)
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
<Popup
|
|
150
|
+
visible={showTop}
|
|
151
|
+
destroyOnClose
|
|
152
|
+
position="top"
|
|
153
|
+
style={{ height: '36%' }}
|
|
154
|
+
onClose={() => {
|
|
155
|
+
setShowTop(false)
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
<Popup
|
|
159
|
+
visible={showBottom}
|
|
160
|
+
position="bottom"
|
|
161
|
+
onClose={() => {
|
|
162
|
+
setShowBottom(false)
|
|
163
|
+
}}
|
|
164
|
+
lockScroll
|
|
165
|
+
style={{ height: '80%' }}
|
|
166
|
+
/>
|
|
167
|
+
<Popup
|
|
168
|
+
visible={showLeft}
|
|
169
|
+
style={{ width: '20%', height: '100%' }}
|
|
170
|
+
position="left"
|
|
171
|
+
onClose={() => {
|
|
172
|
+
setShowLeft(false)
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
<Popup
|
|
176
|
+
visible={showRight}
|
|
177
|
+
style={{ width: '20%', height: '100%' }}
|
|
178
|
+
position="right"
|
|
179
|
+
onClose={() => {
|
|
180
|
+
setShowRight(false)
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
</>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
export default Demo2
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 关闭图标
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { Button, Popup } from '@mijadesign/mjui-react-taro'
|
|
195
|
+
import React, { useState } from 'react'
|
|
196
|
+
|
|
197
|
+
const Demo3 = () => {
|
|
198
|
+
const [showIcon, setShowIcon] = useState(false)
|
|
199
|
+
const [showIconPosition, setShowIconPosition] = useState(false)
|
|
200
|
+
const [showIconDefine, setShowIconDefine] = useState(false)
|
|
201
|
+
|
|
202
|
+
const marginStyle = {
|
|
203
|
+
marginBottom: '12px',
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<>
|
|
208
|
+
<Button
|
|
209
|
+
onClick={() => {
|
|
210
|
+
setShowIcon(true)
|
|
211
|
+
}}
|
|
212
|
+
type="primary"
|
|
213
|
+
fill="outline"
|
|
214
|
+
block
|
|
215
|
+
style={marginStyle}
|
|
216
|
+
>
|
|
217
|
+
底部弹出-仅标题
|
|
218
|
+
</Button>
|
|
219
|
+
|
|
220
|
+
<Button
|
|
221
|
+
onClick={() => {
|
|
222
|
+
setShowIconPosition(true)
|
|
223
|
+
}}
|
|
224
|
+
type="primary"
|
|
225
|
+
fill="outline"
|
|
226
|
+
block
|
|
227
|
+
style={marginStyle}
|
|
228
|
+
>
|
|
229
|
+
底部弹出-带标题及图标
|
|
230
|
+
</Button>
|
|
231
|
+
|
|
232
|
+
<Button
|
|
233
|
+
onClick={() => {
|
|
234
|
+
setShowIconDefine(true)
|
|
235
|
+
}}
|
|
236
|
+
type="primary"
|
|
237
|
+
fill="outline"
|
|
238
|
+
block
|
|
239
|
+
>
|
|
240
|
+
底部弹出-带标题及操作(最大高度)
|
|
241
|
+
</Button>
|
|
242
|
+
<Popup
|
|
243
|
+
closeable={false}
|
|
244
|
+
visible={showIcon}
|
|
245
|
+
title="我是标题"
|
|
246
|
+
position="bottom"
|
|
247
|
+
onClose={() => {
|
|
248
|
+
setShowIcon(false)
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
<Popup
|
|
252
|
+
closeable
|
|
253
|
+
title="我是标题"
|
|
254
|
+
visible={showIconPosition}
|
|
255
|
+
position="bottom"
|
|
256
|
+
onClose={() => {
|
|
257
|
+
setShowIconPosition(false)
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
<Popup
|
|
261
|
+
closeable
|
|
262
|
+
title="我是标题"
|
|
263
|
+
left={
|
|
264
|
+
<div
|
|
265
|
+
onClick={() => {
|
|
266
|
+
setShowIconDefine(false)
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
取消
|
|
270
|
+
</div>
|
|
271
|
+
}
|
|
272
|
+
closeIcon={<div style={{ color: '#006DFC' }}>确认</div>}
|
|
273
|
+
visible={showIconDefine}
|
|
274
|
+
style={{ height: '100%' }}
|
|
275
|
+
position="bottom"
|
|
276
|
+
onClose={() => {
|
|
277
|
+
setShowIconDefine(false)
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
</>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
export default Demo3
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### 阻塞关闭
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { Button, Popup } from '@mijadesign/mjui-react-taro'
|
|
292
|
+
import React, { useState } from 'react'
|
|
293
|
+
|
|
294
|
+
const Demo4 = () => {
|
|
295
|
+
const [showOverlayStop, setShowOverlayStop] = useState(false)
|
|
296
|
+
const [showCloseIconStop, setShowCloseIconStop] = useState(false)
|
|
297
|
+
|
|
298
|
+
const marginStyle = {
|
|
299
|
+
marginBottom: '12px',
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<>
|
|
304
|
+
<Button
|
|
305
|
+
onClick={() => {
|
|
306
|
+
setShowOverlayStop(true)
|
|
307
|
+
}}
|
|
308
|
+
fill="outline"
|
|
309
|
+
type="primary"
|
|
310
|
+
block
|
|
311
|
+
style={marginStyle}
|
|
312
|
+
>
|
|
313
|
+
阻塞点击 Overlay 关闭
|
|
314
|
+
</Button>
|
|
315
|
+
|
|
316
|
+
<Popup
|
|
317
|
+
visible={showOverlayStop}
|
|
318
|
+
style={{ padding: '30px 50px' }}
|
|
319
|
+
onClose={() => {
|
|
320
|
+
setShowOverlayStop(false)
|
|
321
|
+
}}
|
|
322
|
+
onOverlayClick={() => {
|
|
323
|
+
console.log('onOverlayClick')
|
|
324
|
+
return false
|
|
325
|
+
}}
|
|
326
|
+
>
|
|
327
|
+
正文
|
|
328
|
+
</Popup>
|
|
329
|
+
<Button
|
|
330
|
+
onClick={() => {
|
|
331
|
+
setShowCloseIconStop(true)
|
|
332
|
+
}}
|
|
333
|
+
type="primary"
|
|
334
|
+
fill="outline"
|
|
335
|
+
block
|
|
336
|
+
>
|
|
337
|
+
阻塞点击 close icon 关闭
|
|
338
|
+
</Button>
|
|
339
|
+
<Popup
|
|
340
|
+
closeable
|
|
341
|
+
title=" "
|
|
342
|
+
position="bottom"
|
|
343
|
+
visible={showCloseIconStop}
|
|
344
|
+
closeOnOverlayClick={false}
|
|
345
|
+
style={{ height: '40%' }}
|
|
346
|
+
onCloseIconClick={() => {
|
|
347
|
+
console.log('onCloseIconClick')
|
|
348
|
+
setShowCloseIconStop(false)
|
|
349
|
+
}}
|
|
350
|
+
/>
|
|
351
|
+
</>
|
|
352
|
+
)
|
|
353
|
+
}
|
|
354
|
+
export default Demo4
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### 圆角弹框
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import { Button, Popup } from '@mijadesign/mjui-react-taro'
|
|
363
|
+
import React, { useState } from 'react'
|
|
364
|
+
|
|
365
|
+
const Demo4 = () => {
|
|
366
|
+
const [showBottomRound, setShowBottomRound] = useState(false)
|
|
367
|
+
|
|
368
|
+
return (
|
|
369
|
+
<>
|
|
370
|
+
<Button
|
|
371
|
+
onClick={() => {
|
|
372
|
+
setShowBottomRound(true)
|
|
373
|
+
}}
|
|
374
|
+
fill="outline"
|
|
375
|
+
block
|
|
376
|
+
type="primary"
|
|
377
|
+
>
|
|
378
|
+
直角弹框
|
|
379
|
+
</Button>
|
|
380
|
+
<Popup
|
|
381
|
+
visible={showBottomRound}
|
|
382
|
+
style={{ height: '20%' }}
|
|
383
|
+
position="top"
|
|
384
|
+
round={false}
|
|
385
|
+
onClose={() => {
|
|
386
|
+
setShowBottomRound(false)
|
|
387
|
+
}}
|
|
388
|
+
/>
|
|
389
|
+
</>
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
export default Demo4
|
|
393
|
+
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### 多层堆叠
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
```tsx
|
|
400
|
+
import { Button, Popup } from '@mijadesign/mjui-react-taro'
|
|
401
|
+
import React, { useState } from 'react'
|
|
402
|
+
|
|
403
|
+
const Demo6 = () => {
|
|
404
|
+
const [showMutiple, setShowMutiple] = useState(false)
|
|
405
|
+
const [showMutipleInner, setShowMutipleInner] = useState(false)
|
|
406
|
+
|
|
407
|
+
return (
|
|
408
|
+
<>
|
|
409
|
+
<Button
|
|
410
|
+
onClick={() => {
|
|
411
|
+
setShowMutiple(true)
|
|
412
|
+
}}
|
|
413
|
+
fill="outline"
|
|
414
|
+
block
|
|
415
|
+
type="primary"
|
|
416
|
+
>
|
|
417
|
+
多层堆叠
|
|
418
|
+
</Button>
|
|
419
|
+
<Popup
|
|
420
|
+
visible={showMutiple}
|
|
421
|
+
position="bottom"
|
|
422
|
+
style={{ padding: '30px 50px', height: 500, boxSizing: 'border-box' }}
|
|
423
|
+
onClose={() => {
|
|
424
|
+
setShowMutiple(false)
|
|
425
|
+
}}
|
|
426
|
+
>
|
|
427
|
+
<span
|
|
428
|
+
onClick={() => {
|
|
429
|
+
setShowMutipleInner(true)
|
|
430
|
+
}}
|
|
431
|
+
>
|
|
432
|
+
Click It
|
|
433
|
+
</span>
|
|
434
|
+
</Popup>
|
|
435
|
+
<Popup
|
|
436
|
+
visible={showMutipleInner}
|
|
437
|
+
position="bottom"
|
|
438
|
+
style={{ padding: '40px 50px', height: 200, boxSizing: 'border-box' }}
|
|
439
|
+
onClose={() => {
|
|
440
|
+
setShowMutipleInner(false)
|
|
441
|
+
}}
|
|
442
|
+
>
|
|
443
|
+
<span
|
|
444
|
+
onClick={() => {
|
|
445
|
+
setShowMutipleInner(false)
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
close
|
|
449
|
+
</span>
|
|
450
|
+
</Popup>
|
|
451
|
+
</>
|
|
452
|
+
)
|
|
453
|
+
}
|
|
454
|
+
export default Demo6
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### 禁止滚动穿透
|
|
459
|
+
|
|
460
|
+
> 2.3.0 版本更新,仅适用于 H5 与微信小程序
|
|
461
|
+
|
|
462
|
+
使用这类全局遮罩类型的组件时,滑动组件可能会出现底层页面一起滑动的问题。
|
|
463
|
+
|
|
464
|
+
开启 lockScroll 可以阻止 Popup 的背景遮罩层的滚动穿透问题,已默认开启。
|
|
465
|
+
|
|
466
|
+
使用 Taro 提供的 catchMove 可以阻止 Popup 的内容区域的滚动穿透问题,但会导致其本身无法滑动。
|
|
467
|
+
|
|
468
|
+
如果需要内容支持溢出滚动,则需要包裹一层 ScrollView 组件。
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
```tsx
|
|
472
|
+
import { Button, Cell, Popup } from '@mijadesign/mjui-react-taro'
|
|
473
|
+
import { ScrollView } from '@tarojs/components'
|
|
474
|
+
import React, { useState } from 'react'
|
|
475
|
+
|
|
476
|
+
const Demo6 = () => {
|
|
477
|
+
const [scrollPenetration, setScrollPenetration] = useState(false)
|
|
478
|
+
|
|
479
|
+
return (
|
|
480
|
+
<>
|
|
481
|
+
<Button
|
|
482
|
+
onClick={() => {
|
|
483
|
+
setScrollPenetration(true)
|
|
484
|
+
}}
|
|
485
|
+
fill="outline"
|
|
486
|
+
block
|
|
487
|
+
type="primary"
|
|
488
|
+
>
|
|
489
|
+
禁止滚动穿透
|
|
490
|
+
</Button>
|
|
491
|
+
<Popup title="我是标题" visible={scrollPenetration} position="bottom" lockScroll>
|
|
492
|
+
<ScrollView scrollY style={{ height: '300px' }}>
|
|
493
|
+
{Array.from({ length: 200 })
|
|
494
|
+
.fill('')
|
|
495
|
+
.map((_, i) => (
|
|
496
|
+
<Cell key={i}>禁止滚动穿透-{i}</Cell>
|
|
497
|
+
))}
|
|
498
|
+
</ScrollView>
|
|
499
|
+
</Popup>
|
|
500
|
+
</>
|
|
501
|
+
)
|
|
502
|
+
}
|
|
503
|
+
export default Demo6
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## Popup
|
|
508
|
+
|
|
509
|
+
### Props
|
|
510
|
+
|
|
511
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
512
|
+
| ------------------- | ---------------------------------------------- | ------------------------------------------------------------ | ----------- |
|
|
513
|
+
| visible | 当前组件是否显示 | `boolean` | `false` |
|
|
514
|
+
| zIndex | 遮罩层级 | `string` \| `number` | `2000` |
|
|
515
|
+
| duration | 遮罩动画时长,单位毫秒 | `number` | `300` |
|
|
516
|
+
| overlayClassName | 自定义遮罩类名 | `string` | `-` |
|
|
517
|
+
| overlayStyle | 自定义遮罩样式 | `CSSProperties` | `-` |
|
|
518
|
+
| lockScroll | 背景是否锁定 | `boolean` | `true` |
|
|
519
|
+
| overlay | 是否显示遮罩 | `boolean` | `true` |
|
|
520
|
+
| closeOnOverlayClick | 是否点击遮罩关闭 | `boolean` | `true` |
|
|
521
|
+
| position | 弹出位置 | `top` \| `bottom` \| `left` \| `right` \| `center` | `center` |
|
|
522
|
+
| transition | 动画名 | `string` | `-` |
|
|
523
|
+
| closeable | 是否显示关闭按钮 | `boolean` | `false` |
|
|
524
|
+
| closeIconPosition | 关闭按钮位置 | `top-left` \| `top-right` \| `bottom-left` \| `bottom-right` | `top-right` |
|
|
525
|
+
| closeIcon | 自定义 Icon | `ReactNode` | `<Close />` |
|
|
526
|
+
| left | 标题左侧部分 | `ReactNode` | `-` |
|
|
527
|
+
| title | 标题中间部分 | `ReactNode` | `-` |
|
|
528
|
+
| description | 子标题/描述部分 | `ReactNode` | `-` |
|
|
529
|
+
| destroyOnClose | 组件不可见时,卸载内容 | `boolean` | `false` |
|
|
530
|
+
| round | 是否显示圆角 | `boolean` | `true` |
|
|
531
|
+
| portal | 指定节点挂载 | `HTMLElement` \| `(() => HTMLElement)` | `null` |
|
|
532
|
+
| customHeader | 页面是否自定义导航栏,如果自定义,则需要传true | `boolean` | `false` |
|
|
533
|
+
| portal | 指定节点挂载 | `HTMLElement` \| `(() => HTMLElement)` |
|
|
534
|
+
| onClick | 点击弹框时触发 | `event: MouseEvent` | `-` |
|
|
535
|
+
| onCloseIconClick | 点击关闭图标时触发 | `event: MouseEvent` | `-` |
|
|
536
|
+
| onOpen | 打开弹框时触发 | `-` | `-` |
|
|
537
|
+
| onClose | 关闭弹框时触发 | `-` | `-` |
|
|
538
|
+
| afterShow | 继承于`Overlay`, 遮罩打开动画结束时触发 | `event: HTMLElement` | `-` |
|
|
539
|
+
| afterClose | 继承于`Overlay`, 遮罩关闭动画结束时触发 | `event: HTMLElement` | `-` |
|
|
540
|
+
| onOverlayClick | 点击遮罩触发 | `event: MouseEvent` | `-` |
|
|
541
|
+
|
|
542
|
+
## 主题定制
|
|
543
|
+
|
|
544
|
+
### 样式变量
|
|
545
|
+
|
|
546
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
547
|
+
|
|
548
|
+
| 名称 | 说明 | 默认值 |
|
|
549
|
+
| --------------------------------------- | --------------------- | ------------------- |
|
|
550
|
+
| \--nutui-popup-animation-duration | 弹框最大高度 | `0.3s` |
|
|
551
|
+
| \--nutui-popup-border-radius | 弹框的圆角值 | `$radius-3` |
|
|
552
|
+
| \--nutui-popup-description-font-size | 子标题/描述栏的字号 | `$font-size-2` |
|
|
553
|
+
| \--nutui-popup-description-spacing | 子标题/描述栏的间距 | `$spacing-base` |
|
|
554
|
+
| \--nutui-popup-icon-size | 弹框关闭按钮的大小 | `$icon-font-size` |
|
|
555
|
+
| \--nutui-popup-max-height | 弹框最大高度 | `80%` |
|
|
556
|
+
| \--nutui-popup-min-height | 弹框最小高度 | `36%` |
|
|
557
|
+
| \--nutui-popup-title-border-bottom | 标题栏底部边框 | `0` |
|
|
558
|
+
| \--nutui-popup-title-font-size | 标题栏的字号 | `$font-size-3` |
|
|
559
|
+
| \--nutui-popup-title-font-weight | 标题栏的字体权重 | `$font-weight-bold` |
|
|
560
|
+
| \--nutui-popup-title-height | 标题栏的高度 | `inherit` |
|
|
561
|
+
| \--nutui-popup-title-horizontal-padding | 标题栏的水平padding值 | `$spacing-3` |
|
|
562
|
+
| \--nutui-popup-title-padding | 标题栏的padding值 | `20px 16px` |
|
|
563
|
+
| \--nutui-popup-title-vertical-padding | 标题栏的垂直padding值 | `$spacing-4` |
|