refactor: change getMeta to async

This commit is contained in:
Clark Du 2017-11-24 12:11:52 +08:00 committed by Pooya Parsa
parent 30714c989a
commit 4cc4eefcf8

View File

@ -22,17 +22,13 @@ export default class MetaRenderer {
})
}
getMeta(url) {
return new Promise((resolve, reject) => {
const vm = new Vue({
render: (h) => h(), // Render empty html tag
head: this.options.head || {}
})
this.vueRenderer.renderToString(vm, (err) => {
if (err) return reject(err)
resolve(vm.$meta().inject())
})
async getMeta(url) {
const vm = new Vue({
render: h => h(), // Render empty html tag
head: this.options.head || {}
})
await this.vueRenderer.renderToString(vm)
return vm.$meta().inject()
}
async render({ url = '/' }) {