From e9cd89f36f3f9f48026d949e172dca230b6e4ed2 Mon Sep 17 00:00:00 2001 From: tjz <415800467@qq.com> Date: Sat, 14 Jul 2018 17:11:53 +0800 Subject: [PATCH] fix: anchorlink not update links --- components/anchor/Anchor.jsx | 2 +- components/anchor/AnchorLink.jsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/anchor/Anchor.jsx b/components/anchor/Anchor.jsx index fa2117542..f8cf7a726 100644 --- a/components/anchor/Anchor.jsx +++ b/components/anchor/Anchor.jsx @@ -225,7 +225,7 @@ export default { const wrapperStyle = { maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh', - ...getStyle(this, true), + // ...getStyle(this, true), } const anchorContent = ( diff --git a/components/anchor/AnchorLink.jsx b/components/anchor/AnchorLink.jsx index 420528a96..2ad2b69fc 100644 --- a/components/anchor/AnchorLink.jsx +++ b/components/anchor/AnchorLink.jsx @@ -25,6 +25,12 @@ export default { beforeDestroy () { this.antAnchor.unregisterLink(this.href) }, + watch: { + href (val) { + this.antAnchor.unregisterLink(val) + this.antAnchor.registerLink(val) + }, + }, methods: { handleClick () { this.antAnchor.scrollTo(this.href)