diff --git a/src/index-anchor/index.less b/src/index-anchor/index.less index 078819ada..923f725e1 100644 --- a/src/index-anchor/index.less +++ b/src/index-anchor/index.less @@ -15,6 +15,7 @@ top: 0; right: 0; left: 0; + color: @index-anchor-sticky-text-color; background-color: @index-anchor-sticky-background-color; } } diff --git a/src/index-bar/index.js b/src/index-bar/index.js index d37a95347..c57723df4 100644 --- a/src/index-bar/index.js +++ b/src/index-bar/index.js @@ -1,6 +1,5 @@ // Utils import { createNamespace, isDef } from '../utils'; -import { GREEN } from '../utils/constant'; import { isHidden } from '../utils/dom/style'; import { preventDefault } from '../utils/dom/event'; import { @@ -44,14 +43,11 @@ export default createComponent({ props: { zIndex: Number, + highlightColor: String, sticky: { type: Boolean, default: true, }, - highlightColor: { - type: String, - default: GREEN, - }, stickyOffsetTop: { type: Number, default: 0, diff --git a/src/index-bar/index.less b/src/index-bar/index.less index 6a58ee974..1ee621e60 100644 --- a/src/index-bar/index.less +++ b/src/index-bar/index.less @@ -19,5 +19,9 @@ font-weight: @font-weight-bold; font-size: @index-bar-index-font-size; line-height: @index-bar-index-line-height; + + &--active { + color: @index-bar-index-active-color; + } } } diff --git a/src/index-bar/test/__snapshots__/index.spec.js.snap b/src/index-bar/test/__snapshots__/index.spec.js.snap index f038eef00..66721ebb2 100644 --- a/src/index-bar/test/__snapshots__/index.spec.js.snap +++ b/src/index-bar/test/__snapshots__/index.spec.js.snap @@ -14,7 +14,7 @@ exports[`custom anchor text 1`] = ` exports[`scroll and update active anchor 1`] = `
-
ABCDEFGHIJKLMNOPQRSTUVWXYZ
+
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
@@ -32,12 +32,12 @@ exports[`scroll and update active anchor 1`] = ` exports[`scroll and update active anchor 2`] = `
-
ABCDEFGHIJKLMNOPQRSTUVWXYZ
+
ABCDEFGHIJKLMNOPQRSTUVWXYZ
-
1
+
1
-
2
+
2
3
diff --git a/src/style/var.less b/src/style/var.less index a88f96f35..2d9cc90c1 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -376,12 +376,14 @@ @index-anchor-font-size: @font-size-md; @index-anchor-line-height: 32px; @index-anchor-background-color: transparent; +@index-anchor-sticky-text-color: @green; @index-anchor-sticky-background-color: @white; // IndexBar @index-bar-sidebar-z-index: 2; @index-bar-index-font-size: @font-size-xs; @index-bar-index-line-height: 14px; +@index-bar-index-active-color: @green; // Info @info-size: 16px;