3π
Is it possible to change the title once the API returns the data?
Yes, but I donβt know all of your code so I canβt write exactly something you can just copy and paste, but you can adjust it until it works.
The main change would be to make meta.title
a function
{
path: '/home',
meta: {
title: async function() {
var userName = await getUsernameFromWhereverYoureGettingItFrom()
return `Welcome Back, ${username} β Dashboard | A Company`
}
},
name: 'home',
component: () =>
import ('@/views/Home.vue'),
},
Then call that function
watch: {
'$route': async (to, from) {
document.title = to.meta.title ? await to.meta.title() : 'A Company'
}
},
π€George
- [Vuejs]-How to change fontSize for dataLabels?
- [Vuejs]-Vue.js making a data property = to the return value of a method
Source:stackexchange.com