feat(IndexBar): add @index-anchor-z-index、@index-bar-sidebar-z-index less var

This commit is contained in:
陈嘉涵
2020-01-28 12:01:39 +08:00
parent 95d19f70d1
commit 89ee8e3872
6 changed files with 21 additions and 12 deletions

View File

@@ -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({
<div class={bem()}>
<div
class={bem('sidebar')}
style={{ zIndex: this.zIndex + 1 }}
style={this.sidebarStyle}
onClick={this.onClick}
onTouchstart={this.touchStart}
onTouchmove={this.onTouchMove}