mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 01:40:33 +03:00
fix: another inline array to const
This commit is contained in:
@@ -44,6 +44,9 @@ export default function VueMeta(Vue, options = {}) {
|
|||||||
// store an id to keep track of DOM updates
|
// store an id to keep track of DOM updates
|
||||||
let batchID = null
|
let batchID = null
|
||||||
|
|
||||||
|
// for which Vue lifecycle hooks should the metaInfo be refreshed
|
||||||
|
const updateOnLifecycleHook = ['activated', 'deactivated', 'beforeMount']
|
||||||
|
|
||||||
const triggerUpdate = (vm) => {
|
const triggerUpdate = (vm) => {
|
||||||
// batch potential DOM updates to prevent extraneous re-rendering
|
// batch potential DOM updates to prevent extraneous re-rendering
|
||||||
batchID = batchUpdate(batchID, () => vm.$meta().refresh())
|
batchID = batchUpdate(batchID, () => vm.$meta().refresh())
|
||||||
@@ -77,7 +80,7 @@ export default function VueMeta(Vue, options = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
['activated', 'deactivated', 'beforeMount'].forEach((lifecycleHook) => {
|
updateOnLifecycleHook.forEach((lifecycleHook) => {
|
||||||
this.$options[lifecycleHook] = this.$options[lifecycleHook] || []
|
this.$options[lifecycleHook] = this.$options[lifecycleHook] || []
|
||||||
this.$options[lifecycleHook].push(() => triggerUpdate(this))
|
this.$options[lifecycleHook].push(() => triggerUpdate(this))
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user