fix: anchorlink not update links

pull/77/merge
tjz 2018-07-14 17:11:53 +08:00
parent fdd9c3fda8
commit fd0790695f
2 changed files with 7 additions and 1 deletions

View File

@ -225,7 +225,7 @@ export default {
const wrapperStyle = { const wrapperStyle = {
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh', maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh',
...getStyle(this, true), // ...getStyle(this, true),
} }
const anchorContent = ( const anchorContent = (

View File

@ -25,6 +25,12 @@ export default {
beforeDestroy () { beforeDestroy () {
this.antAnchor.unregisterLink(this.href) this.antAnchor.unregisterLink(this.href)
}, },
watch: {
href (val) {
this.antAnchor.unregisterLink(val)
this.antAnchor.registerLink(val)
},
},
methods: { methods: {
handleClick () { handleClick () {
this.antAnchor.scrollTo(this.href) this.antAnchor.scrollTo(this.href)