We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a component that calculates the page title on asyncData. It looks like this:
asyncData
import { Component, Vue } from 'nuxt-property-decorator'; @Comonent({ head() { return { title: this.title } }, asyncData(ctx) { // Calculate title dynamically return { title: 'abc' } } }) export default Comp extends Vue { title!: string; }
But I get an error while trying to access this inside head:
this
head
Property 'title' does not exist on type 'Vue'. Vetur(2339)
Is it possible to achieve this functionality? If yes, how exactly?
The text was updated successfully, but these errors were encountered:
Why not use the head-hook ?
Sorry, something went wrong.
@komninoschat You can use it by specifying this as a parameter for the head. Using your example it will look this way:
import { Component, Vue } from 'nuxt-property-decorator'; @Comonent({ head(this: Comp) { return { title: this.title } }, asyncData(ctx) { // Calculate title dynamically return { title: 'abc' } } }) export default Comp extends Vue { title!: string; }
No branches or pull requests
I have a component that calculates the page title on
asyncData
. It looks like this:But I get an error while trying to access
this
insidehead
:Is it possible to achieve this functionality? If yes, how exactly?
The text was updated successfully, but these errors were encountered: