fix(IndexBar): incorrect anchor position when anchor doesn't have a parent node (#5429)
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-index-anchor {
|
||||
box-sizing: border-box;
|
||||
padding: @index-anchor-padding;
|
||||
color: @index-anchor-text-color;
|
||||
font-weight: @index-anchor-font-weight;
|
||||
|
||||
Reference in New Issue
Block a user