mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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) {
|
async getMeta(url) {
|
||||||
return new Promise((resolve, reject) => {
|
const vm = new Vue({
|
||||||
const vm = new Vue({
|
render: h => h(), // Render empty html tag
|
||||||
render: (h) => h(), // Render empty html tag
|
head: this.options.head || {}
|
||||||
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 = '/' }) {
|
async render({ url = '/' }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user