diff --git a/example/docs/zh-CN/components/dropdown.md b/example/docs/zh-CN/components/dropdown.md
index c6841457..173d9129 100644
--- a/example/docs/zh-CN/components/dropdown.md
+++ b/example/docs/zh-CN/components/dropdown.md
@@ -80,6 +80,37 @@ export default {
}
+
+::: title 禁用弹出
+:::
+
+::: demo
+
+
+
+ 点击无效
+
+
+ 选项一
+ 选项二
+ 选项三
+
+
+
+
+
+
+
:::
::: title Dropdown 属性
@@ -90,6 +121,7 @@ export default {
| 属性 | 描述 | 可选值 |
| ------- | -------- | --------------- |
| trigger | 触发方式 | `click` `hover` |
+| disabled | 是否禁用触发 | `true` `false` |
:::
diff --git a/src/component/dropdown/index.vue b/src/component/dropdown/index.vue
index 0dc9dcfc..ccbad16c 100644
--- a/src/component/dropdown/index.vue
+++ b/src/component/dropdown/index.vue
@@ -12,10 +12,12 @@ import { DropdownTrigger } from "./interface";
export interface LayDropdownProps {
trigger?: DropdownTrigger;
+ disabled?: boolean
}
const props = withDefaults(defineProps(), {
trigger: "click",
+ disabled: false
});
const openState = ref(false);
@@ -26,7 +28,8 @@ onClickOutside(dropdownRef, (event) => {
});
const open = function () {
- openState.value = true;
+ if (props.disabled === false)
+ openState.value = true;
};
const hide = function () {
@@ -34,7 +37,8 @@ const hide = function () {
};
const toggle = function () {
- openState.value = !openState.value;
+ if (props.disabled === false)
+ openState.value = !openState.value;
};
provide("openState", openState);