nuxt / vue-meta

Manage HTML metadata in Vue.js components with SSR support
https://vue-meta.nuxtjs.org
Other
4.08k stars 247 forks source link

How to dynamically update "title" and other meta tags? #813

Open yakhyomus opened 9 months ago

yakhyomus commented 9 months ago

Vuejs 3 ("vue-meta": "^3.0.0-alpha.8")

On my vue page i'm trying update title like that: data() { title: 'title' }, setup () { useMeta({ title: this.title }); }, created() { this.title = 'New title' }

ang get: Cannot read properties of undefined (reading 'title')

How i can fix that? Thank you!

habib-it commented 6 months ago

@yakhyomus any luck?

yakhyomus commented 6 months ago

@yakhyomus any luck?

In vuejs you can't dynamically update meta tags, now i'm using vuejs 2

habib-it commented 6 months ago

@yakhyomus yes brother i tried a way but it also didn't work but i found a solution with new package that is for vue 3 https://www.npmjs.com/package/@unhead/vue https://github.com/unjs/unhead

to dynamic set meta tags we can work like this.