You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's a very interesting and useful article and the code!
I noticed that the pages/index.vue, pages/top.vue, and pages/t/_tag.vue use pretty much the same code. It's possible to use the route name or path to determine what has to be shown and avoid code duplication. There're several simple ways to refactor this:
Move the pages/index.vue content to components/ArticleList.vue (and get an advantage of the new fetch approach being used in components one more time). Call it from index.vue like that:
Use pages/_page.vue as the default route handler and place article list there (but it will require to move authors to the /authors/_username route, and tags to /?tag=.. query).
Write the custom router in the nuxt.config.js.
Convert pages/index.vue, pages/top.vue and pages/t/_tag.vue to the symlinks that point to the same common_pages/index.vue file and parse the route there manually.
The text was updated successfully, but these errors were encountered:
About the 1 way... My mistake, the head method has to be called from the page-level component. Instead of sending title to the ArticleList.vue we could write something like:
That's a very interesting and useful article and the code!
I noticed that the pages/index.vue, pages/top.vue, and pages/t/_tag.vue use pretty much the same code. It's possible to use the route name or path to determine what has to be shown and avoid code duplication. There're several simple ways to refactor this:
Use pages/_page.vue as the default route handler and place article list there (but it will require to move authors to the /authors/_username route, and tags to /?tag=.. query).
Write the custom router in the nuxt.config.js.
Convert pages/index.vue, pages/top.vue and pages/t/_tag.vue to the symlinks that point to the same common_pages/index.vue file and parse the route there manually.
The text was updated successfully, but these errors were encountered: