Skip to content

Commit fd07906

Browse files
committed
fix: anchorlink not update links
1 parent fdd9c3f commit fd07906

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

components/anchor/Anchor.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export default {
225225

226226
const wrapperStyle = {
227227
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh',
228-
...getStyle(this, true),
228+
// ...getStyle(this, true),
229229
}
230230

231231
const anchorContent = (

components/anchor/AnchorLink.jsx

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ export default {
2525
beforeDestroy () {
2626
this.antAnchor.unregisterLink(this.href)
2727
},
28+
watch: {
29+
href (val) {
30+
this.antAnchor.unregisterLink(val)
31+
this.antAnchor.registerLink(val)
32+
},
33+
},
2834
methods: {
2935
handleClick () {
3036
this.antAnchor.scrollTo(this.href)

0 commit comments

Comments
 (0)