mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
refactor: change getMeta to async
This commit is contained in:
parent
30714c989a
commit
4cc4eefcf8
@ -22,17 +22,13 @@ export default class MetaRenderer {
|
||||
})
|
||||
}
|
||||
|
||||
getMeta(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
async getMeta(url) {
|
||||
const vm = new Vue({
|
||||
render: (h) => h(), // Render empty html tag
|
||||
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())
|
||||
})
|
||||
})
|
||||
await this.vueRenderer.renderToString(vm)
|
||||
return vm.$meta().inject()
|
||||
}
|
||||
|
||||
async render({ url = '/' }) {
|
||||
|
Loading…
Reference in New Issue
Block a user