Skip to content

Commit f313eb3

Browse files
authored
fix: 优化 divider 垂直类型写法 (#2664)
* fix: 优化 divider 垂直类型写法 * fix: 移除冗余代码 * fix: 优化demo写法 * fix: 移除无用属性
1 parent 61f6431 commit f313eb3

File tree

9 files changed

+25
-23
lines changed

9 files changed

+25
-23
lines changed

src/packages/divider/demos/h5/demo6.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ const Demo6 = () => {
77
<div>
88
文本
99
<Divider direction="vertical" />
10-
<a href="#" style={{ color: '#1989fa' }}>
10+
<a href="#" style={{ color: '#1989fa', verticalAlign: 'middle' }}>
1111
链接
1212
</a>
1313
<Divider direction="vertical" />
14-
<a href="#" style={{ color: '#1989fa' }}>
14+
<a href="#" style={{ color: '#1989fa', verticalAlign: 'middle' }}>
1515
链接
1616
</a>
1717
</div>
Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
import React from 'react'
22
import { Divider } from '@nutui/nutui-react-taro'
3+
import { View, Text } from '@tarojs/components'
34

45
const Demo6 = () => {
56
return (
6-
<>
7-
<div>
8-
文本
9-
<Divider direction="vertical" />
10-
<a href="#" style={{ color: '#1989fa' }}>
11-
链接
12-
</a>
13-
<Divider direction="vertical" />
14-
<a href="#" style={{ color: '#1989fa' }}>
15-
链接
16-
</a>
17-
</div>
18-
</>
7+
<View>
8+
文本
9+
<Divider direction="vertical" />
10+
<Text
11+
onClick={() => {
12+
console.log('跳转')
13+
}}
14+
style={{ color: '#1989fa', verticalAlign: 'middle' }}
15+
>
16+
链接
17+
</Text>
18+
<Divider direction="vertical" />
19+
<Text
20+
onClick={() => {
21+
console.log('跳转')
22+
}}
23+
style={{ color: '#1989fa', verticalAlign: 'middle' }}
24+
>
25+
链接
26+
</Text>
27+
</View>
1928
)
2029
}
2130
export default Demo6

src/packages/divider/divider.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@
4949
}
5050

5151
&-vertical {
52-
position: relative;
53-
top: $divider-vertical-top;
5452
display: inline-block;
5553
width: auto;
5654
height: $divider-vertical-height;
5755
border-left: 1px solid $divider-border-color;
5856
margin: $divider-vertical-margin;
57+
vertical-align: middle;
5958
}
6059
}
6160

src/packages/divider/doc.en-US.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,4 @@ The component provides the following CSS variables, which can be used to customi
9090
| \--nutui-divider-line-height | The row height of the dividing line | `2px` |
9191
| \--nutui-divider-spacing | The spacing value between the dividing line of the text | `8px` |
9292
| \--nutui-divider-vertical-height | The height of the vertical split line | `12px` |
93-
| \--nutui-divider-vertical-top | The top value of the vertical split line | `2px` |
9493
| \--nutui-divider-vertical-margin | The margin value of the vertical split line | `0 8px` |

src/packages/divider/doc.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,4 @@ import { Divider } from '@nutui/nutui-react'
9090
| \--nutui-divider-line-height | 分割线的行高 | `2px` |
9191
| \--nutui-divider-spacing | 左边分割线与文案的间隔值 | `8px` |
9292
| \--nutui-divider-vertical-height | 垂直分割线的高度 | `12px` |
93-
| \--nutui-divider-vertical-top | 垂直分割线的top值 | `2px` |
9493
| \--nutui-divider-vertical-margin | 垂直分割线的margin值 | `0 8px` |

src/packages/divider/doc.taro.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,4 @@ import { Divider } from '@nutui/nutui-react-taro'
9090
| \--nutui-divider-line-height | 分割线的行高 | `2px` |
9191
| \--nutui-divider-spacing | 左边分割线与文案的间隔值 | `8px` |
9292
| \--nutui-divider-vertical-height | 垂直分割线的高度 | `12px` |
93-
| \--nutui-divider-vertical-top | 垂直分割线的top值 | `2px` |
9493
| \--nutui-divider-vertical-margin | 垂直分割线的margin值 | `0 8px` |

src/packages/divider/doc.zh-TW.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,4 @@ import { Divider } from '@nutui/nutui-react'
9090
| \--nutui-divider-line-height | 分割線的行高 | `2px` |
9191
| \--nutui-divider-spacing | 左邊分割線與文案的間隔值 | `8px` |
9292
| \--nutui-divider-vertical-height | 垂直分割線的高度 | `12px` |
93-
| \--nutui-divider-vertical-top | 垂直分割線的top值 | `2px` |
9493
| \--nutui-divider-vertical-margin | 垂直分割線的margin值 | `0 8px` |

src/styles/variables-jmapp.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ $divider-line-height: var(--nutui-divider-line-height, 2px) !default;
488488
$divider-spacing: var(--nutui-divider-spacing, $spacing-base) !default;
489489
$divider-side-width: var(--nutui-divider-side-width, 16px) !default;
490490
$divider-vertical-height: var(--nutui-divider-vertical-height, 12px) !default;
491-
$divider-vertical-top: var(--nutui-divider-vertical-top, 2px) !default;
492491
$divider-vertical-margin: var(--nutui-divider-vertical-margin, 0 8px) !default;
493492

494493
// icon(✅)

src/styles/variables.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ $divider-line-height: var(--nutui-divider-line-height, 2px) !default;
454454
$divider-spacing: var(--nutui-divider-spacing, 8px) !default;
455455
$divider-side-width: var(--nutui-divider-side-width, 10%) !default;
456456
$divider-vertical-height: var(--nutui-divider-vertical-height, 12px) !default;
457-
$divider-vertical-top: var(--nutui-divider-vertical-top, 2px) !default;
458457
$divider-vertical-margin: var(--nutui-divider-vertical-margin, 0 8px) !default;
459458

460459
// icon(✅)

0 commit comments

Comments
 (0)