@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,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 2
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/layout/pages/divider/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 布局组件
|
|
6
|
+
order: 3
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Divider 分割线
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
用于将内容分隔为多个区域。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Divider } from '@mijadesign/mjui-react-taro';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
默认渲染一条水平分割线。
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import React from 'react'
|
|
29
|
+
import { Divider } from '@mijadesign/mjui-react-taro'
|
|
30
|
+
|
|
31
|
+
const Demo1 = () => {
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<Divider />
|
|
35
|
+
</>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
export default Demo1
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### 内容位置
|
|
44
|
+
|
|
45
|
+
通过 contentPosition 指定内容所在位置。
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import React from 'react'
|
|
50
|
+
import { Divider } from '@mijadesign/mjui-react-taro'
|
|
51
|
+
|
|
52
|
+
const Demo3 = () => {
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<Divider contentPosition="left">文本</Divider>
|
|
56
|
+
<Divider>文本</Divider>
|
|
57
|
+
<Divider contentPosition="right">文本</Divider>
|
|
58
|
+
</>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
export default Demo3
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### 垂直分割线
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { Divider } from '@mijadesign/mjui-react-taro'
|
|
71
|
+
import React from 'react'
|
|
72
|
+
|
|
73
|
+
const Demo6 = () => {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<div style={{ display: 'flex', alignItems: 'center', fontSize: '15px' }}>
|
|
77
|
+
文本
|
|
78
|
+
<Divider direction="vertical" />
|
|
79
|
+
文本
|
|
80
|
+
<Divider direction="vertical" />
|
|
81
|
+
文本
|
|
82
|
+
</div>
|
|
83
|
+
</>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
export default Demo6
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 虚线
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import React from 'react'
|
|
95
|
+
import { Divider } from '@mijadesign/mjui-react-taro'
|
|
96
|
+
|
|
97
|
+
const Demo4 = () => {
|
|
98
|
+
return (
|
|
99
|
+
<>
|
|
100
|
+
<Divider style={{ borderStyle: 'dashed' }}>文本</Divider>
|
|
101
|
+
</>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
export default Demo4
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 自定义样式
|
|
109
|
+
|
|
110
|
+
可以直接通过 style 属性设置分割线的样式。
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import React from 'react'
|
|
115
|
+
import { Divider } from '@mijadesign/mjui-react-taro'
|
|
116
|
+
|
|
117
|
+
const Demo5 = () => {
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
<Divider
|
|
121
|
+
style={{
|
|
122
|
+
color: '#1989fa',
|
|
123
|
+
borderColor: '#1989fa',
|
|
124
|
+
borderStyle: 'dashed',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
文本
|
|
128
|
+
</Divider>
|
|
129
|
+
</>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
export default Demo5
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Divider
|
|
137
|
+
|
|
138
|
+
### Props
|
|
139
|
+
|
|
140
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
141
|
+
| --- | --- | --- | --- |
|
|
142
|
+
| contentPosition | 内容位置 | `left` \| `center` \| `right` | `center` |
|
|
143
|
+
| direction | 水平还是垂直类型 | `horizontal` \| `vertical` | `horizontal` |
|
|
144
|
+
| thin | 分割线的行高类型 | `true` \| `false` |
|
|
145
|
+
|
|
146
|
+
## 主题定制
|
|
147
|
+
|
|
148
|
+
### 样式变量
|
|
149
|
+
|
|
150
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
151
|
+
|
|
152
|
+
| 名称 | 说明 | 默认值 |
|
|
153
|
+
| --- | --- | --- |
|
|
154
|
+
| \--nutui-divider-border-color | 分割线的边框色值 | `$color-border` |
|
|
155
|
+
| \--nutui-divider-line-height | 分割线的行高 | `1px` |
|
|
156
|
+
| \--nutui-divider-margin | 分割线整体内容的margin值 | `16px 0` |
|
|
157
|
+
| \--nutui-divider-spacing | 左边分割线与文案的间隔值 | `$spacing-3` |
|
|
158
|
+
| \--nutui-divider-text-color | 分割线整体内容的颜色 | `$color-text` |
|
|
159
|
+
| \--nutui-divider-text-font-size | 分割线整体内容的font-size大小 | `$font-size-base` |
|
|
160
|
+
| \--nutui-divider-thin-line-height | 分割线的行高 | `0.5px` |
|
|
161
|
+
| \--nutui-divider-vertical-height | 垂直分割线的高度 | `12px` |
|
|
162
|
+
| \--nutui-divider-vertical-margin | 垂直分割线的margin值 | `0 $spacing-3` |
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 3
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/layout/pages/grid/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 布局组件
|
|
6
|
+
order: 3
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Grid 宫格 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
用于分隔成等宽区块进行页面导航。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import React from 'react'
|
|
27
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
28
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
29
|
+
|
|
30
|
+
const Demo1 = () => {
|
|
31
|
+
return (
|
|
32
|
+
<Grid>
|
|
33
|
+
<Grid.Item text="文字">
|
|
34
|
+
<Image />
|
|
35
|
+
</Grid.Item>
|
|
36
|
+
<Grid.Item text="文字">
|
|
37
|
+
<Image />
|
|
38
|
+
</Grid.Item>
|
|
39
|
+
<Grid.Item text="文字">
|
|
40
|
+
<Image />
|
|
41
|
+
</Grid.Item>
|
|
42
|
+
<Grid.Item text="文字">
|
|
43
|
+
<Image />
|
|
44
|
+
</Grid.Item>
|
|
45
|
+
<Grid.Item text="文字">
|
|
46
|
+
<Image />
|
|
47
|
+
</Grid.Item>
|
|
48
|
+
<Grid.Item text="文字">
|
|
49
|
+
<Image />
|
|
50
|
+
</Grid.Item>
|
|
51
|
+
<Grid.Item text="文字">
|
|
52
|
+
<Image />
|
|
53
|
+
</Grid.Item>
|
|
54
|
+
<Grid.Item text="文字">
|
|
55
|
+
<Image />
|
|
56
|
+
</Grid.Item>
|
|
57
|
+
</Grid>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
export default Demo1
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 自定义列数
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import React from 'react'
|
|
69
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
70
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
71
|
+
|
|
72
|
+
const Demo2 = () => {
|
|
73
|
+
return (
|
|
74
|
+
<Grid columns={3}>
|
|
75
|
+
<Grid.Item text="文字">
|
|
76
|
+
<Image />
|
|
77
|
+
</Grid.Item>
|
|
78
|
+
<Grid.Item text="文字">
|
|
79
|
+
<Image />
|
|
80
|
+
</Grid.Item>
|
|
81
|
+
<Grid.Item text="文字">
|
|
82
|
+
<Image />
|
|
83
|
+
</Grid.Item>
|
|
84
|
+
<Grid.Item text="文字">
|
|
85
|
+
<Image />
|
|
86
|
+
</Grid.Item>
|
|
87
|
+
<Grid.Item text="文字">
|
|
88
|
+
<Image />
|
|
89
|
+
</Grid.Item>
|
|
90
|
+
<Grid.Item text="文字">
|
|
91
|
+
<Image />
|
|
92
|
+
</Grid.Item>
|
|
93
|
+
</Grid>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
export default Demo2
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 正方形格子
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import React from 'react'
|
|
105
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
106
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
107
|
+
|
|
108
|
+
const Demo3 = () => {
|
|
109
|
+
return (
|
|
110
|
+
<Grid columns={3} square>
|
|
111
|
+
<Grid.Item text="文字">
|
|
112
|
+
<Image />
|
|
113
|
+
</Grid.Item>
|
|
114
|
+
<Grid.Item text="文字">
|
|
115
|
+
<Image />
|
|
116
|
+
</Grid.Item>
|
|
117
|
+
<Grid.Item text="文字">
|
|
118
|
+
<Image />
|
|
119
|
+
</Grid.Item>
|
|
120
|
+
</Grid>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
export default Demo3
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 格子间距
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import React from 'react'
|
|
132
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
133
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
134
|
+
|
|
135
|
+
const Demo4 = () => {
|
|
136
|
+
return (
|
|
137
|
+
<Grid gap={3}>
|
|
138
|
+
<Grid.Item text="文字">
|
|
139
|
+
<Image />
|
|
140
|
+
</Grid.Item>
|
|
141
|
+
<Grid.Item text="文字">
|
|
142
|
+
<Image />
|
|
143
|
+
</Grid.Item>
|
|
144
|
+
<Grid.Item text="文字">
|
|
145
|
+
<Image />
|
|
146
|
+
</Grid.Item>
|
|
147
|
+
<Grid.Item text="文字">
|
|
148
|
+
<Image />
|
|
149
|
+
</Grid.Item>
|
|
150
|
+
<Grid.Item text="文字">
|
|
151
|
+
<Image />
|
|
152
|
+
</Grid.Item>
|
|
153
|
+
<Grid.Item text="文字">
|
|
154
|
+
<Image />
|
|
155
|
+
</Grid.Item>
|
|
156
|
+
<Grid.Item text="文字">
|
|
157
|
+
<Image />
|
|
158
|
+
</Grid.Item>
|
|
159
|
+
<Grid.Item text="文字">
|
|
160
|
+
<Image />
|
|
161
|
+
</Grid.Item>
|
|
162
|
+
</Grid>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
export default Demo4
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 内容翻转
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import React from 'react'
|
|
174
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
175
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
176
|
+
|
|
177
|
+
const Demo5 = () => {
|
|
178
|
+
return (
|
|
179
|
+
<Grid reverse>
|
|
180
|
+
<Grid.Item text="文字">
|
|
181
|
+
<Image />
|
|
182
|
+
</Grid.Item>
|
|
183
|
+
<Grid.Item text="文字">
|
|
184
|
+
<Image />
|
|
185
|
+
</Grid.Item>
|
|
186
|
+
<Grid.Item text="文字">
|
|
187
|
+
<Image />
|
|
188
|
+
</Grid.Item>
|
|
189
|
+
<Grid.Item text="文字">
|
|
190
|
+
<Image />
|
|
191
|
+
</Grid.Item>
|
|
192
|
+
</Grid>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
export default Demo5
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 内容横向
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import React from 'react'
|
|
204
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
205
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
206
|
+
|
|
207
|
+
const Demo6 = () => {
|
|
208
|
+
return (
|
|
209
|
+
<Grid direction="horizontal">
|
|
210
|
+
<Grid.Item text="文字">
|
|
211
|
+
<Image />
|
|
212
|
+
</Grid.Item>
|
|
213
|
+
<Grid.Item text="文字">
|
|
214
|
+
<Image />
|
|
215
|
+
</Grid.Item>
|
|
216
|
+
<Grid.Item text="文字">
|
|
217
|
+
<Image />
|
|
218
|
+
</Grid.Item>
|
|
219
|
+
<Grid.Item text="文字">
|
|
220
|
+
<Image />
|
|
221
|
+
</Grid.Item>
|
|
222
|
+
</Grid>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
export default Demo6
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 内容翻转 + 横向
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
import React from 'react'
|
|
234
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
235
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
236
|
+
|
|
237
|
+
const Demo7 = () => {
|
|
238
|
+
return (
|
|
239
|
+
<Grid reverse direction="horizontal">
|
|
240
|
+
<Grid.Item text="文字">
|
|
241
|
+
<Image />
|
|
242
|
+
</Grid.Item>
|
|
243
|
+
<Grid.Item text="文字">
|
|
244
|
+
<Image />
|
|
245
|
+
</Grid.Item>
|
|
246
|
+
<Grid.Item text="文字">
|
|
247
|
+
<Image />
|
|
248
|
+
</Grid.Item>
|
|
249
|
+
<Grid.Item text="文字">
|
|
250
|
+
<Image />
|
|
251
|
+
</Grid.Item>
|
|
252
|
+
</Grid>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
export default Demo7
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 图标颜色/大小
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import React from 'react'
|
|
264
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
265
|
+
import { Image } from '@nutui/icons-react-taro'
|
|
266
|
+
|
|
267
|
+
const Demo8 = () => {
|
|
268
|
+
return (
|
|
269
|
+
<Grid columns="3">
|
|
270
|
+
<Grid.Item text="文字">
|
|
271
|
+
<Image size={16} />
|
|
272
|
+
</Grid.Item>
|
|
273
|
+
<Grid.Item text="文字">
|
|
274
|
+
<Image color="red" />
|
|
275
|
+
</Grid.Item>
|
|
276
|
+
<Grid.Item text="文字">
|
|
277
|
+
<Image size={30} color="#478EF2" />
|
|
278
|
+
</Grid.Item>
|
|
279
|
+
</Grid>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
export default Demo8
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### 自定义内容
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
import React from 'react'
|
|
291
|
+
import { Grid, Image } from '@mijadesign/mjui-react-taro'
|
|
292
|
+
|
|
293
|
+
const Demo9 = () => {
|
|
294
|
+
const imgSrc =
|
|
295
|
+
'https://m.360buyimg.com/babel/jfs/t1/36973/29/11270/120042/5cf1fe3cEac2b5898/10c2722d0cc0bfa7.png'
|
|
296
|
+
return (
|
|
297
|
+
<Grid columns={3} square>
|
|
298
|
+
<Grid.Item>
|
|
299
|
+
<Image src={imgSrc} width="100%" height="100%" />
|
|
300
|
+
</Grid.Item>
|
|
301
|
+
<Grid.Item>
|
|
302
|
+
<Image src={imgSrc} width="100%" height="100%" />
|
|
303
|
+
</Grid.Item>
|
|
304
|
+
<Grid.Item>
|
|
305
|
+
<Image src={imgSrc} width="100%" height="100%" />
|
|
306
|
+
</Grid.Item>
|
|
307
|
+
</Grid>
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
export default Demo9
|
|
311
|
+
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 点击子项事件
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
import React from 'react'
|
|
319
|
+
import { Grid } from '@mijadesign/mjui-react-taro'
|
|
320
|
+
import { Image as ImageIcon } from '@nutui/icons-react-taro'
|
|
321
|
+
import Taro from '@tarojs/taro'
|
|
322
|
+
|
|
323
|
+
const Demo10 = () => {
|
|
324
|
+
const imgSrc =
|
|
325
|
+
'https://m.360buyimg.com/babel/jfs/t1/36973/29/11270/120042/5cf1fe3cEac2b5898/10c2722d0cc0bfa7.png'
|
|
326
|
+
const onClick = (item: any, index: number) => {
|
|
327
|
+
Taro.showToast({ title: `点击了${item.text},第${index}个` })
|
|
328
|
+
}
|
|
329
|
+
return (
|
|
330
|
+
<Grid direction="horizontal" onClick={onClick}>
|
|
331
|
+
<Grid.Item text="文字">
|
|
332
|
+
<ImageIcon />
|
|
333
|
+
</Grid.Item>
|
|
334
|
+
<Grid.Item text="文字">
|
|
335
|
+
<ImageIcon />
|
|
336
|
+
</Grid.Item>
|
|
337
|
+
<Grid.Item text="文字">
|
|
338
|
+
<ImageIcon />
|
|
339
|
+
</Grid.Item>
|
|
340
|
+
<Grid.Item text="文字">
|
|
341
|
+
<ImageIcon />
|
|
342
|
+
</Grid.Item>
|
|
343
|
+
</Grid>
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
export default Demo10
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## Grid
|
|
351
|
+
|
|
352
|
+
### Props
|
|
353
|
+
|
|
354
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
355
|
+
| --- | --- | --- | --- |
|
|
356
|
+
| columns | 列数 | `number` \| `string` | `4` |
|
|
357
|
+
| gap | 格子之间的间距,默认单位为`px` | `number` \| `string` | `0` |
|
|
358
|
+
| center | 是否将格子内容居中显示 | `boolean` | `true` |
|
|
359
|
+
| square | 是否将格子固定为正方形 | `boolean` | `false` |
|
|
360
|
+
| reverse | 内容翻转 | `boolean` | `false` |
|
|
361
|
+
| direction | 格子内容排列的方向 | `horizontal` \| `vertical` | `vertical` |
|
|
362
|
+
| onClick | 宫格子项点击事件 | `(index) => void` | `-` |
|
|
363
|
+
|
|
364
|
+
## Grid.Item
|
|
365
|
+
|
|
366
|
+
### Props
|
|
367
|
+
|
|
368
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
369
|
+
| --- | --- | --- | --- |
|
|
370
|
+
| text | 文字 | `string` \| `ReactNode` | `-` |
|
|
371
|
+
| onClick | 点击格子时触发 | `(event: Event) => void` | `-` |
|
|
372
|
+
|
|
373
|
+
## 主题定制
|
|
374
|
+
|
|
375
|
+
### 样式变量
|
|
376
|
+
|
|
377
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)。
|
|
378
|
+
|
|
379
|
+
| 名称 | 说明 | 默认值 |
|
|
380
|
+
| --- | --- | --- |
|
|
381
|
+
| \--nutui-grid-border-color | 边框颜色 | `#f5f6f7` |
|
|
382
|
+
| \--nutui-grid-item-content-padding | 内边距 | `16px 8px` |
|
|
383
|
+
| \--nutui-grid-item-content-bg-color | 背景 | `$white` |
|
|
384
|
+
| \--nutui-grid-item-text-margin | 外边距 | `8px` |
|
|
385
|
+
| \--nutui-grid-item-text-color | 文字颜色 | `$color-title` |
|
|
386
|
+
| \--nutui-grid-item-text-font-size | 文字字体大小 | `$font-size-small` |
|