Skip to content

Commit 28ad03b

Browse files
feat: ✨ DropMenuItem 增加自定 Popup 样式参数
1 parent 29b97a3 commit 28ad03b

3 files changed

Lines changed: 33 additions & 23 deletions

File tree

docs/component/drop-menu.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ function handleOpened() {
138138
```
139139

140140
```typescript
141-
142141
import { useMessage } from '@/uni_modules/wot-design-uni'
143142
const messageBox = useMessage()
144143

@@ -149,7 +148,7 @@ const option = ref<Record<string, any>>([
149148
{ label: '新款商品', value: 1 },
150149
{ label: '活动商品', value: 2 }
151150
])
152-
151+
153152
// 通过对话框确认是否打开/关闭下拉菜单
154153
const handleBeforeToggle: DropMenuItemBeforeToggle = ({ status, resolve }) => {
155154
messageBox
@@ -197,19 +196,19 @@ const handleBeforeToggle: DropMenuItemBeforeToggle = ({ status, resolve }) => {
197196

198197
## DropMenuItem Attributes
199198

200-
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
201-
| --------- | ---------------------------------------------------------------------- | --------------- | ------ | ------ | -------- |
202-
| v-model | 当前选中项对应选中的 value | string / number | - | - | - |
203-
| disabled | 禁用菜单 | boolean | - | false | - |
204-
| options | 列表数据,对应数据结构 `[{text: '标题', value: '0', tip: '提示文字'}]` | array | - | - | - |
205-
| icon-name | 选中的图标名称(可选名称在 wd-icon 组件中) | string | - | check | - |
206-
| title | 菜单标题 | string | - | - | - |
207-
| icon | 菜单图标 | string | - | arrow-down | - |
208-
| icon-size | 菜单图标尺寸 | string | - | 14px | _ |
209-
| before-toggle | 下拉菜单打开或者关闭前触发,`reslove(true)`时继续执行打开或关闭操作 | function({ status, resolve }) | - | - | 1.3.7 |
210-
| value-key | 选项对象中,value 对应的 key | string | - | value | - |
211-
| label-key | 选项对象中,展示的文本对应的 key | string | - | label | - |
212-
| tip-key | 选项对象中,选项说明对应的 key | string | - | tip | - |
199+
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
200+
| ------------- | ---------------------------------------------------------------------- | ----------------------------- | ------ | ---------- | -------- |
201+
| v-model | 当前选中项对应选中的 value | string / number | - | - | - |
202+
| disabled | 禁用菜单 | boolean | - | false | - |
203+
| options | 列表数据,对应数据结构 `[{text: '标题', value: '0', tip: '提示文字'}]` | array | - | - | - |
204+
| icon-name | 选中的图标名称(可选名称在 wd-icon 组件中) | string | - | check | - |
205+
| title | 菜单标题 | string | - | - | - |
206+
| icon | 菜单图标 | string | - | arrow-down | - |
207+
| icon-size | 菜单图标尺寸 | string | - | 14px | \_ |
208+
| before-toggle | 下拉菜单打开或者关闭前触发,`reslove(true)`时继续执行打开或关闭操作 | function({ status, resolve }) | - | - | 1.3.7 |
209+
| value-key | 选项对象中,value 对应的 key | string | - | value | - |
210+
| label-key | 选项对象中,展示的文本对应的 key | string | - | label | - |
211+
| tip-key | 选项对象中,选项说明对应的 key | string | - | tip | - |
213212

214213
## DropdownItem Events
215214

@@ -250,8 +249,10 @@ const handleBeforeToggle: DropMenuItemBeforeToggle = ({ status, resolve }) => {
250249

251250
## DropMenuItem 外部样式类
252251

253-
| 类名 | 说明 | 最低版本 |
254-
| ------------ | --------------------------- | -------- |
255-
| custom-class | DropMenuItem 根节点样式 | - |
256-
| custom-title | DropMenuItem 左侧文字样式 | - |
257-
| custom-icon | DropMenuItem 右侧 icon 样式 | - |
252+
| 类名 | 说明 | 最低版本 |
253+
| ------------------ | --------------------------- | ---------------- |
254+
| custom-class | DropMenuItem 根节点样式 | - |
255+
| custom-title | DropMenuItem 左侧文字样式 | - |
256+
| custom-icon | DropMenuItem 右侧 icon 样式 | - |
257+
| custom-popup-class | 自定义下拉菜单 popup 样式类 | $LOWEST_VERSION$ |
258+
| custom-popup-style | 自定义下拉菜单 popup 样式 | $LOWEST_VERSION$ |

src/uni_modules/wot-design-uni/components/wd-drop-menu-item/types.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ export const dorpMenuItemProps = {
6363
/**
6464
* 选项对象中,选项说明对应的 key
6565
*/
66-
tipKey: makeStringProp('tip')
66+
tipKey: makeStringProp('tip'),
67+
/**
68+
* 自定义下拉菜单popup样式类
69+
*/
70+
customPopupClass: makeStringProp(''),
71+
/**
72+
* 自定义下拉菜单popup样式
73+
*/
74+
customPopupStyle: makeStringProp('')
6775
}
6876

6977
export type DropMenuItemProps = ExtractPropTypes<typeof dorpMenuItemProps>
@@ -75,4 +83,4 @@ export type DropMenuItemExpose = {
7583
toggle: () => void
7684
}
7785

78-
export type DropMenuItemInstance = ComponentPublicInstance<DropMenuItemProps>
86+
export type DropMenuItemInstance = ComponentPublicInstance<DropMenuItemProps, DropMenuItemExpose>

src/uni_modules/wot-design-uni/components/wd-drop-menu-item/wd-drop-menu-item.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
:z-index="zIndex"
66
:duration="duration"
77
:position="position"
8-
custom-style="position: absolute; max-height: 80%;"
8+
:custom-style="`position: absolute; max-height: 80%;${customPopupStyle}`"
9+
:custom-class="customPopupClass"
910
modal-style="position: absolute;"
1011
:modal="modal"
1112
:close-on-click-modal="false"

0 commit comments

Comments
 (0)