Skip to content

Commit 624be13

Browse files
committed
fix: 鸿蒙样式
1 parent 60527bb commit 624be13

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/packages/address/elevator.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
padding: 0 16px;
1212
display: flex;
1313
flex-wrap: wrap;
14-
justify-content: flex-start;
15-
align-items: left;
14+
align-items: flex-start;
1615
&-item {
1716
display: flex;
1817
justify-content: center;
@@ -22,15 +21,25 @@
2221
font-size: 12px;
2322
border-radius: 4px;
2423
margin-bottom: 7px;
24+
/* #ifdef harmony*/
25+
margin-right: 6px;
26+
/* #endif */
27+
/* #ifndef harmony*/
28+
margin-right: 7px;
29+
/* #endif */
2530
background-color: $color-background-sunken;
2631
color: $color-title;
27-
&:last-child {
32+
&:nth-child(5n) {
2833
margin-right: 0;
2934
}
3035
}
3136

32-
&:has(.nut-address-hotlist-item:nth-child(5)) {
33-
justify-content: space-between;
37+
&.hotlist-more {
38+
.nut-address-hotlist-item {
39+
width: auto;
40+
padding: 0 16px;
41+
margin-right: 7px;
42+
}
3443
}
3544
}
3645

src/packages/address/elevatorRender.taro.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const ElevatorRender: FunctionComponent<
8686
},
8787
} = useConfig()
8888
const classPrefix = 'nut-address'
89+
const MAX_LENGTH = 10
8990

9091
const [value, setValue] = usePropsValue({
9192
value: outerValue,
@@ -237,7 +238,9 @@ export const ElevatorRender: FunctionComponent<
237238
return (
238239
<>
239240
<View className={`${classPrefix}-title`}>{hotCity}</View>
240-
<View className={`${classPrefix}-hotlist`}>
241+
<View
242+
className={`${classPrefix}-hotlist ${hotList.length > MAX_LENGTH ? 'hotlist-more' : ''}`}
243+
>
241244
{hotList.map((item, index) => (
242245
<View
243246
className={`${classPrefix}-hotlist-item`}

src/packages/address/elevatorRender.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export const ElevatorRender: FunctionComponent<
8585
},
8686
} = useConfig()
8787
const classPrefix = 'nut-address'
88+
const MAX_LENGTH = 10
8889

8990
const [value, setValue] = usePropsValue({
9091
value: outerValue,
@@ -236,7 +237,9 @@ export const ElevatorRender: FunctionComponent<
236237
return (
237238
<>
238239
<div className={`${classPrefix}-title`}>{hotCity}</div>
239-
<div className={`${classPrefix}-hotlist`}>
240+
<div
241+
className={`${classPrefix}-hotlist ${hotList.length > MAX_LENGTH ? 'hotlist-more' : ''}`}
242+
>
240243
{hotList.map((item, index) => (
241244
<div
242245
className={`${classPrefix}-hotlist-item`}

0 commit comments

Comments
 (0)