diff --git a/src/index-anchor/index.less b/src/index-anchor/index.less index cdc7a0b26..078819ada 100644 --- a/src/index-anchor/index.less +++ b/src/index-anchor/index.less @@ -1,6 +1,7 @@ @import '../style/var'; .van-index-anchor { + z-index: @index-anchor-z-index; box-sizing: border-box; padding: @index-anchor-padding; color: @index-anchor-text-color; diff --git a/src/index-bar/index.js b/src/index-bar/index.js index cca4e7466..d37a95347 100644 --- a/src/index-bar/index.js +++ b/src/index-bar/index.js @@ -1,5 +1,5 @@ // Utils -import { createNamespace } from '../utils'; +import { createNamespace, isDef } from '../utils'; import { GREEN } from '../utils/constant'; import { isHidden } from '../utils/dom/style'; import { preventDefault } from '../utils/dom/event'; @@ -43,14 +43,11 @@ export default createComponent({ ], props: { + zIndex: Number, sticky: { type: Boolean, default: true, }, - zIndex: { - type: Number, - default: 1, - }, highlightColor: { type: String, default: GREEN, @@ -72,6 +69,14 @@ export default createComponent({ }, computed: { + sidebarStyle() { + if (isDef(this.zIndex)) { + return { + zIndex: this.zIndex + 1, + }; + } + }, + highlightStyle() { const { highlightColor } = this; if (highlightColor) { @@ -237,7 +242,7 @@ export default createComponent({