diff --git a/src/dropdown-menu/index.js b/src/dropdown-menu/index.js
index 087193685..383591887 100644
--- a/src/dropdown-menu/index.js
+++ b/src/dropdown-menu/index.js
@@ -1,6 +1,5 @@
// Utils
-import { createNamespace } from '../utils';
-import { BORDER_TOP_BOTTOM } from '../utils/constant';
+import { createNamespace, isDef } from '../utils';
import { getScroller } from '../utils/dom/scroll';
// Mixins
@@ -49,15 +48,27 @@ export default createComponent({
scroller() {
return getScroller(this.$el);
},
+
+ opened() {
+ return this.children.some((item) => item.showWrapper);
+ },
+
+ barStyle() {
+ if (this.opened && isDef(this.zIndex)) {
+ return {
+ zIndex: 1 + this.zIndex,
+ };
+ }
+ },
},
methods: {
updateOffset() {
- if (!this.$refs.menu) {
+ if (!this.$refs.bar) {
return;
}
- const rect = this.$refs.menu.getBoundingClientRect();
+ const rect = this.$refs.bar.getBoundingClientRect();
if (this.direction === 'down') {
this.offset = rect.bottom;
@@ -113,8 +124,14 @@ export default createComponent({
));
return (
-
- {Titles}
+
+
+ {Titles}
+
{this.slots('default')}
);
diff --git a/src/dropdown-menu/index.less b/src/dropdown-menu/index.less
index ff747bc28..e293babc3 100644
--- a/src/dropdown-menu/index.less
+++ b/src/dropdown-menu/index.less
@@ -1,11 +1,20 @@
@import '../style/var';
.van-dropdown-menu {
- display: flex;
- height: @dropdown-menu-height;
- background-color: @dropdown-menu-background-color;
user-select: none;
+ &__bar {
+ position: relative;
+ display: flex;
+ height: @dropdown-menu-height;
+ background-color: @dropdown-menu-background-color;
+ box-shadow: 0 2px 12px fade(@gray-7, 8);
+
+ &--opened {
+ z-index: @dropdown-item-z-index + 1;
+ }
+ }
+
&__item {
display: flex;
flex: 1;
@@ -44,7 +53,7 @@
right: -4px;
margin-top: -5px;
border: 3px solid;
- border-color: transparent transparent currentColor currentColor;
+ border-color: transparent transparent @gray-4 @gray-4;
transform: rotate(-45deg);
opacity: 0.8;
content: '';
@@ -52,6 +61,10 @@
&--active {
color: @dropdown-menu-title-active-text-color;
+
+ &::after {
+ border-color: transparent transparent currentColor currentColor;
+ }
}
&--down {
diff --git a/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap b/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap
index 5afee72d1..2e154118c 100644
--- a/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap
+++ b/src/dropdown-menu/test/__snapshots__/demo.spec.js.snap
@@ -3,9 +3,11 @@
exports[`renders demo correctly 1`] = `