2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-24 02:40:33 +03:00

refresh meta info only computed $metaInfo exists

This commit is contained in:
heww
2017-05-16 10:46:42 +08:00
parent 96f9c1d1bd
commit 8bdd303322
+6 -2
View File
@@ -60,13 +60,17 @@ export default function VueMeta (Vue, options = {}) {
}, },
beforeMount () { beforeMount () {
// batch potential DOM updates to prevent extraneous re-rendering // batch potential DOM updates to prevent extraneous re-rendering
batchID = batchUpdate(batchID, () => this.$meta().refresh()) if (this.$metaInfo) {
batchID = batchUpdate(batchID, () => this.$meta().refresh())
}
}, },
destroyed () { destroyed () {
// do not trigger refresh on the server side // do not trigger refresh on the server side
if (this.$isServer) return if (this.$isServer) return
// re-render meta data when returning from a child component to parent // re-render meta data when returning from a child component to parent
batchID = batchUpdate(batchID, () => this.$meta().refresh()) if (this.$metaInfo) {
batchID = batchUpdate(batchID, () => this.$meta().refresh())
}
} }
}) })
} }