fix(IndexBar): incorrect anchor position when anchor doesn't have a parent node (#5429)

This commit is contained in:
neverland
2019-12-30 21:46:53 +08:00
committed by GitHub
parent 3a4983b250
commit a154e0683a
4 changed files with 26 additions and 24 deletions

View File

@@ -14,8 +14,9 @@ export default createComponent({
data() {
return {
top: 0,
active: false,
position: 'static'
left: null,
width: null,
active: false
};
},
@@ -27,10 +28,11 @@ export default createComponent({
anchorStyle() {
if (this.sticky) {
return {
position: this.position,
zIndex: `${this.parent.zIndex}`,
left: this.left ? `${this.left}px` : null,
width: this.width ? `${this.width}px` : null,
transform: `translate3d(0, ${this.top}px, 0)`,
color: this.parent.highlightColor,
color: this.parent.highlightColor
};
}
}