Skip to content

Commit e59fd56

Browse files
feat: ✨ DroMenu 图标大小和位置样式逻辑调整为不缩放且不使用绝对定位 (#1243)
1 parent b26c08c commit e59fd56

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

docs/component/drop-menu.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function handleOpened() {
116116

117117
```html
118118
<wd-drop-menu>
119-
<wd-drop-menu-item title="地图" icon="location" icon-size="24px" />
119+
<wd-drop-menu-item title="地图" icon="location" icon-size="14px" />
120120
</wd-drop-menu>
121121
```
122122

@@ -137,22 +137,24 @@ function handleOpened() {
137137

138138
```typescript
139139
import { useMessage } from '@/uni_modules/wot-design-uni'
140+
import type { DropMenuItemBeforeToggle } from '@/uni_modules/wot-design-uni/components/wd-drop-menu-item/types'
141+
140142
const messageBox = useMessage()
141143

142144
const value = ref<number>(0)
143145

144146
const option = ref<Record<string, any>[]>([
145147
{ label: '全部商品', value: 0 },
146-
{ label: '新款商品', value: 1 },
147-
{ label: '活动商品', value: 2 }
148+
{ label: '新款商品', value: 1, tip: '这是补充信息' },
149+
{ label: '这是比较长的筛选条件这是比较长的筛选条件', value: 2 }
148150
])
149151

150152
// 通过对话框确认是否打开/关闭下拉菜单
151153
const handleBeforeToggle: DropMenuItemBeforeToggle = ({ status, resolve }) => {
152154
messageBox
153155
.confirm({
154-
title: `异步${status ? '打开' : '关闭'}`,
155-
msg: `确定要${status ? '打开' : '关闭'}下拉菜单吗?`
156+
title: `${status ? '异步打开' : '异步关闭'}`,
157+
msg: `${status ? '确定要打开下拉菜单吗' : '确定要关闭下拉菜单吗'}`
156158
})
157159
.then(() => {
158160
resolve(true)

docs/en-US/component/drop-menu.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ You can set the menu's right icon through `icon`, equivalent to the `name` prope
116116

117117
```html
118118
<wd-drop-menu>
119-
<wd-drop-menu-item title="Map" icon="location" icon-size="24px" />
119+
<wd-drop-menu-item title="Map" icon="location" icon-size="14px" />
120120
</wd-drop-menu>
121121
```
122122

@@ -137,6 +137,8 @@ The `before-toggle` function cannot prevent the expansion/closure operations of
137137

138138
```typescript
139139
import { useMessage } from '@/uni_modules/wot-design-uni'
140+
import type { DropMenuItemBeforeToggle } from '@/uni_modules/wot-design-uni/components/wd-drop-menu-item/types'
141+
140142
const messageBox = useMessage()
141143

142144
const value = ref<number>(0)

src/subPages/dropMenu/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</demo-block>
3838
<demo-block :title="$t('zi-ding-yi-cai-dan-tu-biao')" transparent>
3939
<wd-drop-menu>
40-
<wd-drop-menu-item :title="$t('di-tu')" icon="location" icon-size="24px" />
40+
<wd-drop-menu-item :title="$t('di-tu')" icon="location" icon-size="14px" />
4141
</wd-drop-menu>
4242
</demo-block>
4343
<demo-block :title="$t('yi-bu-da-kai-guan-bi')" transparent>

src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ $-divider-vertical-line-width: var(--wot-divider-vertical-line-width, 1px) !defa
294294
$-drop-menu-height: var(--wot-drop-menu-height, 48px) !default; // 展示选中项的高度
295295
$-drop-menu-color: var(--wot-drop-menu-color, $-color-content) !default; // 展示选中项的颜色
296296
$-drop-menu-fs: var(--wot-drop-menu-fs, $-fs-content) !default; // 展示选中项的字号
297-
$-drop-menu-arrow-fs: var(--wot-drop-menu-arrow-fs, $-fs-content) !default; // 箭头图标大小
297+
$-drop-menu-arrow-fs: var(--wot-drop-menu-arrow-fs, $-fs-secondary) !default; // 箭头图标大小
298298

299299
$-drop-menu-side-padding: var(--wot-drop-menu-side-padding, $-size-side-padding) !default; // 两边留白间距
300300
$-drop-menu-disabled-color: var(--wot-drop-menu-disabled-color, rgba(0, 0, 0, 0.25)) !default; // 禁用颜色

src/uni_modules/wot-design-uni/components/wd-drop-menu/index.scss

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
opacity: 1;
4242
}
4343
:deep(.wd-drop-menu__arrow) {
44-
transform: scale(0.6) rotate(-180deg);
44+
transform: rotate(-180deg);
4545
transform-origin: center center;
4646
}
4747
}
@@ -52,7 +52,9 @@
5252

5353
@include e(item-title) {
5454
position: relative;
55-
display: inline-block;
55+
display: inline-flex;
56+
align-items: center;
57+
justify-content: center;
5658
max-width: 100%;
5759
padding: 0 $-drop-menu-side-padding;
5860
box-sizing: border-box;
@@ -78,13 +80,7 @@
7880
}
7981

8082
@include edeep(arrow) {
81-
position: absolute;
82-
display: inline-block;
83-
top: 0;
84-
right: -4px;
85-
transition: transform 0.3s;
86-
transform: scale(0.6);
8783
font-size: $-drop-menu-arrow-fs;
88-
line-height: $-drop-menu-height;
84+
margin-left: 2px;
8985
}
9086
}

0 commit comments

Comments
 (0)