mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 19:07:15 +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) => {
|
||||
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 = '/' }) {
|
||||
|
Loading…
Reference in New Issue
Block a user