diff --git a/src/dropdown-item/index.js b/src/dropdown-item/index.js
index bfa1ec551..d8a31a9ef 100644
--- a/src/dropdown-item/index.js
+++ b/src/dropdown-item/index.js
@@ -2,12 +2,13 @@ import { createNamespace } from '../utils';
import Cell from '../cell';
import Icon from '../icon';
import Popup from '../popup';
+import { PortalMixin } from '../mixins/portal';
import { ChildrenMixin } from '../mixins/relation';
const [createComponent, bem] = createNamespace('dropdown-item');
export default createComponent({
- mixins: [ChildrenMixin('vanDropdownMenu')],
+ mixins: [PortalMixin({ ref: 'wrapper' }), ChildrenMixin('vanDropdownMenu')],
props: {
value: null,
@@ -106,26 +107,33 @@ export default createComponent({
}
return (
-
-
{
- this.showWrapper = false;
- this.$emit('closed');
- }}
+
+
- {Options}
- {this.slots('default')}
-
+
{
+ this.showWrapper = false;
+ this.$emit('closed');
+ }}
+ >
+ {Options}
+ {this.slots('default')}
+
+
);
}
diff --git a/src/dropdown-menu/README.md b/src/dropdown-menu/README.md
index bb3db48e7..e5e62eb65 100644
--- a/src/dropdown-menu/README.md
+++ b/src/dropdown-menu/README.md
@@ -129,6 +129,7 @@ Use `active-color` prop to custom active color of the title and options
| options | Options | *Option[]* | `[]` | - |
| disabled | Whether to disable dropdown item | *boolean* | `false` | - |
| title-class | Title class | *string* | - | - |
+| get-container | Return the mount node for menu | *string \| () => Element* | - | 2.2.4 |
### DropdownItem Events
diff --git a/src/dropdown-menu/README.zh-CN.md b/src/dropdown-menu/README.zh-CN.md
index 09d6b6ff8..cc084caf7 100644
--- a/src/dropdown-menu/README.zh-CN.md
+++ b/src/dropdown-menu/README.zh-CN.md
@@ -133,6 +133,7 @@ export default {
| options | 选项数组 | *Option[]* | `[]` | - |
| disabled | 是否禁用菜单 | *boolean* | `false` | - |
| title-class | 标题额外类名 | *string* | - | - |
+| get-container | 指定弹出菜单挂载的节点,可以传入选择器,
或一个返回节点的函数 | *string \| () => Element* | - | 2.2.4 |
### DropdownItem Events
diff --git a/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap b/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap
index 13c27a5ba..30cb1b513 100644
--- a/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap
+++ b/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap
@@ -6,11 +6,15 @@ exports[`renders demo correctly 1`] = `