@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,364 @@
1
+ ---
2
+ order: 17
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/dentry/pages/radio/index'
4
+ group:
5
+ title: 数据录入
6
+ order: 5
7
+ ---
8
+
9
+ # Radio 单选按钮 <Badge>2.0.0</Badge>
10
+
11
+
12
+ 用于在一组备选项中进行单选
13
+
14
+ ## 引入
15
+
16
+ ```tsx
17
+ import { Radio } from '@mijadesign/mjui-react-taro';
18
+
19
+ ```
20
+
21
+ ## 示例代码
22
+
23
+ ### 基础单选
24
+
25
+
26
+ ```tsx
27
+ import React from 'react'
28
+ import { Radio } from '@mijadesign/mjui-react-taro'
29
+
30
+ const Demo1 = () => {
31
+ return (
32
+ <div style={{ padding: '16px 0 0 0' }}>
33
+ <Radio defaultChecked>选项一</Radio>
34
+ </div>
35
+ )
36
+ }
37
+ export default Demo1
38
+
39
+ ```
40
+
41
+ ## 横向单选
42
+
43
+
44
+ ```tsx
45
+ import { Radio } from '@mijadesign/mjui-react-taro'
46
+ import React from 'react'
47
+
48
+ const Demo6 = () => {
49
+ return (
50
+ <Radio.Group defaultValue="1" direction="horizontal" style={{ margin: '16px 0' }}>
51
+ <Radio value="1">选项一</Radio>
52
+ <Radio value="2">选项一</Radio>
53
+ <Radio value="3">选项一</Radio>
54
+ </Radio.Group>
55
+ )
56
+ }
57
+ export default Demo6
58
+
59
+ ```
60
+
61
+ ## 单选状态
62
+
63
+
64
+ ```tsx
65
+ import React from 'react'
66
+ import { Radio } from '@mijadesign/mjui-react-taro'
67
+
68
+ const Demo13 = () => {
69
+ return (
70
+ <>
71
+ <Radio.Group defaultValue="3">
72
+ <Radio value="1">选项1</Radio>
73
+ <Radio value="2" disabled>
74
+ 选项1
75
+ </Radio>
76
+ <Radio value="3">选项1</Radio>
77
+ </Radio.Group>
78
+ <Radio.Group defaultValue="4">
79
+ <Radio value="4" disabled>
80
+ 选项1
81
+ </Radio>
82
+ </Radio.Group>
83
+ </>
84
+ )
85
+ }
86
+ export default Demo13
87
+
88
+ ```
89
+
90
+ ## 单选位置
91
+
92
+
93
+ ```tsx
94
+ import React from 'react'
95
+ import { Cell, Radio } from '@mijadesign/mjui-react-taro'
96
+
97
+ const Demo14 = () => {
98
+ return (
99
+ <Cell.Group>
100
+ <Cell>
101
+ <Radio value="1">Icon位置在左侧</Radio>
102
+ </Cell>
103
+ <Cell>
104
+ <Radio value="2" labelPosition="left" style={{ width: '100%' }}>
105
+ Icon位置在右侧
106
+ </Radio>
107
+ </Cell>
108
+ </Cell.Group>
109
+ )
110
+ }
111
+ export default Demo14
112
+
113
+ ```
114
+
115
+ ### Group 模式下禁用某一项
116
+
117
+
118
+ ```tsx
119
+ import { Radio } from '@mijadesign/mjui-react-taro'
120
+ import React from 'react'
121
+
122
+ const Demo2 = () => {
123
+ return (
124
+ <Radio.Group defaultValue="1">
125
+ <Radio disabled value="1">
126
+ 选项1
127
+ </Radio>
128
+ <Radio value="2">选项2</Radio>
129
+ <Radio value="3">选项3</Radio>
130
+ </Radio.Group>
131
+ )
132
+ }
133
+ export default Demo2
134
+
135
+ ```
136
+
137
+ ### Group 模式下禁用全部选项
138
+
139
+
140
+ ```tsx
141
+ import React from 'react'
142
+ import { Radio } from '@mijadesign/mjui-react-taro'
143
+
144
+ const Demo3 = () => {
145
+ return (
146
+ <Radio.Group disabled defaultValue="1">
147
+ <Radio value="1">选项1</Radio>
148
+ <Radio value="2">选项2</Radio>
149
+ <Radio value="3">选项3</Radio>
150
+ </Radio.Group>
151
+ )
152
+ }
153
+ export default Demo3
154
+
155
+ ```
156
+
157
+ ### 自定义图标
158
+
159
+
160
+ ```tsx
161
+ import { Selected } from '@mijadesign/mobile-icons'
162
+ import { Radio } from '@mijadesign/mjui-react-taro'
163
+ import React from 'react'
164
+
165
+ const Demo8 = () => {
166
+ return (
167
+ <div style={{ padding: '16px 0 0 0' }}>
168
+ <Radio icon={<Selected />} activeIcon={<Selected />}>
169
+ 自定义图标
170
+ </Radio>
171
+ </div>
172
+ )
173
+ }
174
+ export default Demo8
175
+
176
+ ```
177
+
178
+ ### 自定义图标,通过Group实现列表形式
179
+
180
+
181
+ ```tsx
182
+ import { Selected } from '@mijadesign/mobile-icons'
183
+ import { Radio } from '@mijadesign/mjui-react-taro'
184
+ import React from 'react'
185
+
186
+ const Demo9 = () => {
187
+ return (
188
+ <Radio.Group defaultValue="1" labelPosition="left" style={{ width: '100%' }}>
189
+ <Radio icon={<Selected />} activeIcon={<Selected />} value="1">
190
+ 自定义图标
191
+ </Radio>
192
+ <Radio icon={<Selected />} activeIcon={<Selected />} value="2">
193
+ 自定义图标
194
+ </Radio>
195
+ </Radio.Group>
196
+ )
197
+ }
198
+ export default Demo9
199
+
200
+ ```
201
+
202
+ ### 触发事件
203
+
204
+
205
+ ```tsx
206
+ import React, { useState } from 'react'
207
+ import { Radio } from '@mijadesign/mjui-react-taro'
208
+ import Taro from '@tarojs/taro'
209
+
210
+ const Demo10 = () => {
211
+ const [checkedValue] = useState(1)
212
+ return (
213
+ <>
214
+ <Radio.Group
215
+ defaultValue={checkedValue}
216
+ onChange={(value) =>
217
+ Taro.showToast({
218
+ icon: 'none',
219
+ title: value.toString(),
220
+ })
221
+ }
222
+ >
223
+ <Radio value={1}>触发事件</Radio>
224
+ <Radio value={2}>触发事件</Radio>
225
+ </Radio.Group>
226
+ </>
227
+ )
228
+ }
229
+ export default Demo10
230
+
231
+ ```
232
+
233
+ ## 自定义图标
234
+
235
+ 建议 `icon` `activeIcon` 一起修改
236
+
237
+
238
+ ```tsx
239
+ import { Selected } from '@mijadesign/mobile-icons'
240
+ import { Radio } from '@mijadesign/mjui-react-taro'
241
+ import React from 'react'
242
+
243
+ const Demo8 = () => {
244
+ return (
245
+ <div style={{ padding: '16px 0 0 0' }}>
246
+ <Radio icon={<Selected />} activeIcon={<Selected />}>
247
+ 自定义图标
248
+ </Radio>
249
+ </div>
250
+ )
251
+ }
252
+ export default Demo8
253
+
254
+ ```
255
+
256
+ ## 自定义图标,通过Group实现列表形式
257
+
258
+ 建议 `icon` `activeIcon` 一起修改
259
+
260
+
261
+ ```tsx
262
+ import { Selected } from '@mijadesign/mobile-icons'
263
+ import { Radio } from '@mijadesign/mjui-react-taro'
264
+ import React from 'react'
265
+
266
+ const Demo9 = () => {
267
+ return (
268
+ <Radio.Group defaultValue="1" labelPosition="left" style={{ width: '100%' }}>
269
+ <Radio icon={<Selected />} activeIcon={<Selected />} value="1">
270
+ 自定义图标
271
+ </Radio>
272
+ <Radio icon={<Selected />} activeIcon={<Selected />} value="2">
273
+ 自定义图标
274
+ </Radio>
275
+ </Radio.Group>
276
+ )
277
+ }
278
+ export default Demo9
279
+
280
+ ```
281
+
282
+ ## 触发事件
283
+
284
+
285
+ ```tsx
286
+ import React, { useState } from 'react'
287
+ import { Radio } from '@mijadesign/mjui-react-taro'
288
+ import Taro from '@tarojs/taro'
289
+
290
+ const Demo10 = () => {
291
+ const [checkedValue] = useState(1)
292
+ return (
293
+ <>
294
+ <Radio.Group
295
+ defaultValue={checkedValue}
296
+ onChange={(value) =>
297
+ Taro.showToast({
298
+ icon: 'none',
299
+ title: value.toString(),
300
+ })
301
+ }
302
+ >
303
+ <Radio value={1}>触发事件</Radio>
304
+ <Radio value={2}>触发事件</Radio>
305
+ </Radio.Group>
306
+ </>
307
+ )
308
+ }
309
+ export default Demo10
310
+
311
+ ```
312
+
313
+
314
+ ## Radio
315
+
316
+ ### Props
317
+
318
+ | 属性 | 说明 | 类型 | 默认值 |
319
+ | --- | --- | --- | --- |
320
+ | checked | 指定当前是否选中 | `boolean` | `-` |
321
+ | defaultChecked | 初始是否选中 | `boolean` | `-` |
322
+ | disabled | 是否禁用选择 | `boolean` | `false` |
323
+ | value | 携带的标识值,用于 Group 模式 | `string` \| `number` | `-` |
324
+ | labelPosition | 文本所在的位置 | `left` \| `right` | `right` |
325
+ | icon | <a href="#/icon">图标名称</a>,选中前(建议和`activeIcon`一起修改) | `ReactNode` | `'CheckNormal'` |
326
+ | activeIcon | <a href="#/icon">图标名称</a>,选中后(建议和`icon`一起修改) | `ReactNode` | `'CheckChecked'` |
327
+ | shape | 形状 | `button` \| `round` |`round` |
328
+ | onChange | 选中态变化时触发 | `(checked: boolean) => void` | `-` |
329
+
330
+ ## Radio.Group
331
+
332
+ ### Props
333
+
334
+ | 属性 | 说明 | 类型 | 默认值 |
335
+ | --- | --- | --- | --- |
336
+ | value | 当前选中项的标识符 | `string` \| `number` | `-` |
337
+ | labelPosition | 文本所在的位置 | `left` \| `right` | `right` |
338
+ | disabled | 是否禁用 | `boolean` | `false` |
339
+ | shape | 形状 | `button` \| `round` |`-` |
340
+ | direction | 使用横纵方向 | `horizontal` \| `vertical` | `vertical` |
341
+ | options | 配置 options 渲染单选按钮 | `Array<{ label: string value: string disabled?: boolean }>` | `-` |
342
+ | onChange | 值变化时触发 | `(value: string \| number) => void` | `-` |
343
+
344
+ ## 主题定制
345
+
346
+ ### 样式变量
347
+
348
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
349
+
350
+ | 名称 | 说明 | 默认值 |
351
+ | --- | --- | --- |
352
+ | \--nutui-radio-icon-font-size | icon字号 | `20px` |
353
+ | \--nutui-radio-label-font-size | 字号 | `$font-size-2` |
354
+ | \--nutui-radio-label-color | 字体颜色 | `$color-title` |
355
+ | \--nutui-radio-label-margin-left | label 的左外边距 | `4px` |
356
+ | \--nutui-radio-button-font-size | shape为button的字号 | `12px` |
357
+ | \--nutui-radio-button-color | 字体颜色 | `$color-text` |
358
+ | \--nutui-radio-button-background | shape为button的背景色 | `$color-background` |
359
+ | \--nutui-radio-button-active-border | shape为button选中态的边框 | `1px solid $color-primary` |
360
+ | \--nutui-radio-button-padding | shape为button的内边距 | `5px 18px` |
361
+ | \--nutui-radio-button-border-radius | shape为button的圆角 | `15px` |
362
+ | \--nutui-radiogroup-radio-margin | Group模式下每个 radio 的右侧边距 | `16px` |
363
+ | \--nutui-radiogroup-radio-margin-bottom | Group模式下每个 radio 的底部边距 | `12px` |
364
+ | \--nutui-radiogroup-radio-label-margin | Group模式下每个 radio 中的 label 外边距 | `0 4px 0 4px` |
@@ -0,0 +1,317 @@
1
+ ---
2
+ order: 21
3
+ demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/dentry/pages/searchbar/index'
4
+ group:
5
+ title: 数据录入
6
+ order: 5
7
+ ---
8
+
9
+ # SearchBar 搜索栏 <Badge>2.0.0</Badge>
10
+
11
+
12
+ 用于搜索场景的输入框组件。
13
+
14
+ ## 引入
15
+
16
+ ```tsx
17
+ import { SearchBar } from '@mijadesign/mjui-react-taro';
18
+ ```
19
+
20
+ ## 示例代码
21
+
22
+ ### 基础用法
23
+
24
+ `SearchBar` 的 `placeholder` 属性支持自定义。
25
+
26
+
27
+ ```tsx
28
+ import { SearchBar } from '@mijadesign/mjui-react-taro'
29
+ import React from 'react'
30
+
31
+ const Demo = () => {
32
+ return <SearchBar placeholder="搜索预设文案" />
33
+ }
34
+ export default Demo
35
+
36
+ ```
37
+
38
+ ### 对齐方式
39
+
40
+
41
+ ```tsx
42
+ import React, { useRef, useState } from 'react';
43
+ import { SearchBar } from '@mijadesign/mjui-react-taro';
44
+ import { Search } from '@mijadesign/mobile-icons';
45
+ import classNames from 'classnames';
46
+ import '../../demo.scss';
47
+
48
+ const Demo2 = () => {
49
+ const [focus, setFocus] = useState(false);
50
+ const searchRef = useRef<any>(null);
51
+ return (
52
+ <>
53
+ <div style={{ marginBottom: '20px' }}>
54
+ <div style={{ marginBottom: '8px', fontSize: '13px' }}>默认态左对齐</div>
55
+ <SearchBar placeholder='搜索预设文案' />
56
+ </div>
57
+ <div>
58
+ <div style={{ marginBottom: '8px', fontSize: '13px' }}>居中对齐</div>
59
+ <SearchBar
60
+ searchRef={searchRef}
61
+ onClick={() => {
62
+ setFocus(true);
63
+ process.env.TARO_ENV === 'weapp' && searchRef?.current?.focus?.();
64
+ }}
65
+ onBlur={(value) => {
66
+ setFocus(!!value);
67
+ }}
68
+ leftIn={
69
+ !focus ? (
70
+ <div className='custom-searchbar-left-in'>
71
+ <Search />
72
+ <div>搜索</div>
73
+ </div>
74
+ ) : (
75
+ <Search />
76
+ )
77
+ }
78
+ // autoFocus={focus}
79
+ className={classNames('custom-searchbar', { 'custom-searchbar-focus': !!focus })}
80
+ placeholder='搜索'
81
+ />
82
+ </div>
83
+ </>
84
+ );
85
+ };
86
+ export default Demo2;
87
+
88
+ ```
89
+
90
+ ### 搜索框形状
91
+
92
+ `SearchBar` 的 `shape` 属性支持定义圆角直角,`maxLength` 可控制输入字符的最大长度。
93
+
94
+
95
+ ```tsx
96
+ import { SearchBar } from '@mijadesign/mjui-react-taro'
97
+ import React, { useState } from 'react'
98
+
99
+ const Demo3 = () => {
100
+ const [show, SetShow] = useState(false)
101
+ const toastShow = () => {
102
+ SetShow(true)
103
+ }
104
+ return (
105
+ <>
106
+ <div style={{ marginBottom: '12px' }}>
107
+ <SearchBar placeholder="圆角8px" />
108
+ </div>
109
+ <div>
110
+ <SearchBar shape="round" placeholder="全圆角" />
111
+ </div>
112
+ </>
113
+ )
114
+ }
115
+ export default Demo3
116
+
117
+ ```
118
+
119
+ ### 搜索框高度
120
+
121
+ `SearchBar` 的 `shape` 属性支持定义圆角直角,`maxLength` 可控制输入字符的最大长度。
122
+
123
+
124
+ ```tsx
125
+ import { SearchBar } from '@mijadesign/mjui-react-taro'
126
+ import React from 'react'
127
+
128
+ const Demo8 = () => {
129
+ return (
130
+ <>
131
+ <div style={{ marginBottom: '12px' }}>
132
+ <SearchBar placeholder="高度32px" />
133
+ </div>
134
+ <div>
135
+ <SearchBar contentHeight={44} placeholder="高度44px" />
136
+ </div>
137
+ </>
138
+ )
139
+ }
140
+ export default Demo8
141
+
142
+ ```
143
+
144
+ ### 支持返回
145
+
146
+ 点击返回,返回上一级页面,`SearchBar` 的 `left` 属性可以设置搜索框左侧内容,
147
+
148
+
149
+ ```tsx
150
+ import { SearchBar } from '@mijadesign/mjui-react-taro'
151
+ import { ArrowLeft } from '@mijadesign/mobile-icons'
152
+ import React from 'react'
153
+
154
+ const Demo4 = () => {
155
+ return <SearchBar left={<ArrowLeft size={20} onClick={() => console.log('点击返回')} />} placeholder="搜索预设文案" />
156
+ }
157
+ export default Demo4
158
+
159
+ ```
160
+
161
+ ### 支持取消
162
+ 点击取消返回上一级页面, `SearchBar` 的`right` 属性可以设置搜索框右侧内容
163
+
164
+
165
+
166
+ ```tsx
167
+ import { SearchBar } from '@mijadesign/mjui-react-taro'
168
+ import React from 'react'
169
+
170
+ const Demo5 = () => {
171
+ return (
172
+ <>
173
+ <SearchBar right={<div onClick={() => console.log('click')}>取消</div>} />
174
+ </>
175
+ )
176
+ }
177
+ export default Demo5
178
+
179
+ ```
180
+
181
+ ### 颜色自定义
182
+
183
+ 支持自定义搜索框颜色、描边色
184
+
185
+
186
+ ```tsx
187
+ import { ConfigProvider, SearchBar } from '@mijadesign/mjui-react-taro'
188
+ import React from 'react'
189
+
190
+ const Demo6 = () => {
191
+ return (
192
+ <>
193
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px', marginBottom: '20px' }}>
194
+ <div style={{ fontSize: '13px' }}>支持自定义搜索框颜色、描边色</div>
195
+ <ConfigProvider
196
+ theme={{
197
+ nutuiSearchbarContentBackground: '#E6F0FF',
198
+ }}
199
+ >
200
+ <SearchBar />
201
+ </ConfigProvider>
202
+ <ConfigProvider
203
+ theme={{
204
+ nutuiSearchbarContentBackground: '#fff',
205
+ nutuiSearchbarContentBorder: '1px solid #eee',
206
+ }}
207
+ >
208
+ <SearchBar border />
209
+ </ConfigProvider>
210
+ </div>
211
+
212
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
213
+ <div style={{ fontSize: '13px' }}>支持自定义搜索框外颜色</div>
214
+ <ConfigProvider
215
+ theme={{
216
+ nutuiSearchbarBackground: 'var(--nutui-color-primary)',
217
+ nutuiSearchbarContentBackground: '#fff',
218
+ nutuiSearchbarPadding: '6px 12px',
219
+ }}
220
+ >
221
+ <SearchBar />
222
+ </ConfigProvider>
223
+ </div>
224
+ </>
225
+ )
226
+ }
227
+ export default Demo6
228
+
229
+ ```
230
+
231
+ ### 数据改变监听
232
+
233
+ `SearchBar` 的 `onChange` 可获取输入的内容。
234
+
235
+
236
+ ```tsx
237
+ import React, { useState } from 'react'
238
+ import { SearchBar } from '@mijadesign/mjui-react-taro'
239
+
240
+ const Demo7 = () => {
241
+ const [value, setValue] = useState('')
242
+ return (
243
+ <>
244
+ <SearchBar onChange={(val: string) => setValue(val)} maxLength={10} />
245
+ <div
246
+ style={{
247
+ height: '40px',
248
+ lineHeight: '40px',
249
+ color: '#666',
250
+ fontSize: '14px',
251
+ }}
252
+ >
253
+ {value}
254
+ </div>
255
+ </>
256
+ )
257
+ }
258
+ export default Demo7
259
+
260
+ ```
261
+
262
+ ## SearchBar
263
+
264
+ ### Props
265
+
266
+ | 属性 | 说明 | 类型 | 默认值 |
267
+ | --- | --- | --- | --- |
268
+ | value | 当前输入的值,受控 | `string` | `-` |
269
+ | defaultValue | 当前默认值,支持通过','分割成多个 | `string` | `-` |
270
+ | placeholder | 输入框默认暗纹 | `string` | `请输入` |
271
+ | shape | 搜索框形状,可选值为 `round` | `string` | `square` |
272
+ | disabled | 是否禁用输入框 | `boolean` | `false` |
273
+ | readOnly | 输入框只读 | `boolean` | `false` |
274
+ | maxLength | 最大输入长度 | `number` | `9999` |
275
+ | clearable | 是否展示清除按钮 | `boolean` | `true` |
276
+ | autoFocus | 是否自动聚焦 | `boolean` | `false` |
277
+ | backable | 是否展示返回按钮 | `boolean` | `false` |
278
+ | border | 是否展示边框 | `boolean` | `false` |
279
+ | contentHeight | 输入框高度 | `number` | `32` |
280
+ | left | 搜索框左侧区域 | `ReactNode` | `-` |
281
+ | right | 搜搜框右侧区域 | `ReactNode` | `-` |
282
+ | leftIn | 输入框内左侧区域 | `ReactNode` | `<Search />` |
283
+ | rightIn | 输入框内右侧区域 | `ReactNode` | `-` |
284
+ | onChange | 输入内容时触发 | `(value: string, event: ChangeEvent<HTMLInputElement>) => void` | `-` |
285
+ | onFocus | 聚焦时触发 | `(value: string, event: FocusEvent<HTMLInputElement>) => void` | `-` |
286
+ | onBlur | 失焦时触发 | `(value: string, event: FocusEvent<HTMLInputElement>) => void` | `-` |
287
+ | onClear | 点击清空时触发 | `(event: MouseEvent<HTMLDivElement>) => void` | `-` |
288
+ | onSearch | 确定搜索时触发 | `(val: string) => void` | `-` |
289
+ | onInputClick | 点击输入区域时触发 | `(event: MouseEvent<HTMLInputElement>) => void` | `-` |
290
+ | onItemClick | 点击默认值的x号触发 | `(value: string) => void` | `-` |
291
+
292
+ ## 主题定制
293
+
294
+ ### 样式变量
295
+
296
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
297
+
298
+ | 名称 | 说明 | 默认值 |
299
+ | --- | --- | --- |
300
+ | \--nutui-searchbar-background | 搜索框背景色 | `inherit` |
301
+ | \--nutui-searchbar-color | 搜索框字色 | `$color-title` |
302
+ | \--nutui-searchbar-content-background | 搜索框中间内容区的背景色 | `$color-background` |
303
+ | \--nutui-searchbar-content-border | 搜索框内容区边框 | `1px solid $color-border` |
304
+ | \--nutui-searchbar-content-border-radius | 搜索框内容区圆角 | `$radius-1` |
305
+ | \--nutui-searchbar-content-round-border-radius | 搜索框内容区在round模式下的圆角 | `$radius-circle` |
306
+ | \--nutui-searchbar-font-size | 搜索框字号 | `$font-size-2` |
307
+ | \--nutui-searchbar-gap | 搜索框外部/大间距 | `$spacing-2` |
308
+ | \--nutui-searchbar-icon-size | 搜索框icon字号 | `$icon-font-size` |
309
+ | \--nutui-searchbar-inner-gap | 搜索框内部元素间的间距 | `$spacing-1` |
310
+ | \--nutui-searchbar-input-curror-color | 搜索框输入区输入色 | `$color-text-disabled` |
311
+ | \--nutui-searchbar-input-height | 搜索框输入区高度 | `32px` |
312
+ | \--nutui-searchbar-input-padding | 搜索框输入区padding | `0 0 0 8px` |
313
+ | \--nutui-searchbar-input-text-align | 搜索框输入区对齐方式 | `left` |
314
+ | \--nutui-searchbar-input-text-color | 搜索框输入区字色 | `$color-title` |
315
+ | \--nutui-searchbar-padding | 搜索框的padding值 | `0px 0px` |
316
+ | \--nutui-searchbar-right-color | 搜索框右侧字色 | `$color-primary` |
317
+ | \--nutui-searchbar-width | 搜索框的宽度 | `100%` |