Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue Head Is not reactive #102

Open
chaderenyore opened this issue Apr 23, 2022 · 2 comments
Open

Vue Head Is not reactive #102

chaderenyore opened this issue Apr 23, 2022 · 2 comments

Comments

@chaderenyore
Copy link

Suppose in my data I set articleTItle to null or ' ';

articleTitle: null,

and then in vue head

title: function () {
        return {
          inner: this.articleTitle,
          separator: "-",
          complement: "Coin Profit Blog",
        };
      },

It will take the null and stick to it alone, if the articleTitle should change the title doesn't change
this.articleTitle = this.post.data.article_title;

Vue head is not reactive it doesn't react to the changes, it just takes the first value and stick to it.
I reallly need it to be reactive so that after fecthing the blog data then the tile will change. I know this can be done with Nuxt well, but I'm not using Nuxt now, I really need this.

@kobayashi-naoki
Copy link

README helped me.

@AustinThornley
Copy link

AustinThornley commented Feb 3, 2023

Similar issue, my page title wasn't updating correctly if I was using a computed property for the title. I was able to use updated() lifecycle hook to help. Now whenever the component updates, it will make sure to update the article title.

Script
articleTitle: null

updated() {
     // Simply set articleTitle here: 
     this.articleTitle = 'new title';
}

Template

<vue-head>
     <title>{{ articleTitle ? articleTitle : 'Fallback title' }}</title>
</vue-head>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants