how can i pass my api Value to Header title on vue? im using nuxt.
I try using this but i got error ‘blog is not defined’
async asyncData({params, error}) {
try {
let topBlogger = await axios.get('http://api.bla.bla/API/topblogger.php')
let isi = await axios.get(`http://api.bla.bla/API/news.php?id_artikel=${+params.id}`)
let tagList = await axios.get('https://api.bla.bla/users')
return {
bloggers: topBlogger.data,
blog: isi.data,
tags: tagList.data,
}
} catch (e) {
error({message: 'User not found', statusCode: 404})
}
},
head () {
return {
title: blog.id_artikel+' | title bla bla',
meta: [
{ hid: 'description', name: 'description', content: 'content dll' }
]
}
},
but when i use blog on <template></template>
it work
i’m new on vueJS so still can’t seem understand well how it work
2
Answers
You need to access data using this
This may be helpful for you.