1

I am new to Nuxt and trying to make a Single Product. I wonder:

  1. How is it possible to generate multiple pages in SSR and can create a new HTML for each page? Is CSR should be created first and then the SSR made or vice versa?
  2. If Vuex is used and a method dispatched in async Data is it possible to get data in computed? I mean is HTML generated dynamically if we get data in computed session? how should I use Vuex and be sure that every product certainly has its own HTML page?

Thank you

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
sara
  • 21
  • 3
  • You just need to create a file with specific name in folder with your component/route, for example component/id.vue as I remember, but u better check the docs to be sure. For the second question you can add a guard on route – Alopwer Aug 23 '22 at 07:28

1 Answers1

2
  1. All pages created are generated SSR by default if the mode is set to SSR or Universal. First, files will be generated from the server and then injected into the client-side. You can avoid SSR in specific sections using the client-only tag. Nuxt pages Nuxt SSR
    Q: Why should I use client-only?
    A: Because it's possible when you use some dependencies, it returns undefined so we use client-only to render it on the client side and avoid this problem.
  2. It is possible to use asyncData's value in components computed property. You're looking for dynamic routes (pages). You can access the information inside this using $route.
Amini
  • 1,620
  • 1
  • 8
  • 26