[Vuejs]-Add static text in html generated by nuxt

0๐Ÿ‘

โœ…

I found solution:

When generating routes pass payload to related page:

{
  route: `/fruit/${name}`,
  payload: { fruitName: name }
},

and set data in asyncData hook:

async asyncData({ params, error, payload }) {
  if (payload) {
    return {
      name: payload.name
    }
  }
}

and here a data set in component and can access it through component and it is static and set in generated html file for each route.

Leave a comment