Skip to content

Commit

Permalink
fix($medium-zoom): not updating on component update (#994)
Browse files Browse the repository at this point in the history
* ⬆️ upgrade to medium-zoom@1.0.2

* πŸ› fix medium-zoom not updating on component update

* ⬇️ downgrade to medium-zoom@0.4.0 to fix serverside rendering bug

* πŸ‘Œ use arrow function 'this' and outsource updateZoom to function
  • Loading branch information
dcastil authored and ulivz committed Nov 13, 2018
1 parent ecb1920 commit 6aa4d91
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions packages/@vuepress/plugin-medium-zoom/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,24 @@ import './style.css'
import zoom from 'medium-zoom'

export default {
data: () => ({ zoom: null }),

mounted () {
setTimeout(() => {
zoom(SELECTOR)
}, 1000)
this.updateZoom()
},

updated () {
this.updateZoom()
},

methods: {
updateZoom () {
setTimeout(() => {
if (this.zoom) {
this.zoom.detach()
}
this.zoom = zoom(SELECTOR)
}, 1000)
}
}
}

0 comments on commit 6aa4d91

Please sign in to comment.