Navigating routes dynamically with NuxtJs

I'm facing a challenge with routes in NuxtJS (a Vue.js framework) and I'm wondering how to create routes like the ones below using the pages directory or another method:

Example:

Sample routes:

/some-route-of-page-2021

/some-route-of-page-2022 and so on for each year.

The 2021/2021 represents the dynamic year in the route structure.

Answer №1

Embracing the concept of a dynamic variable embedded within a path is fully supported in Nuxt3. In contrast, Nuxt2 restricts you to using /some-route-of-page/XXX. It may appear more sensible to adopt this structure in such scenarios. Typically, having multiple variables interpolated directly into the path can become convoluted and perplexing in my opinion.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Deleting a user in Vue.js using Firebase UID

I'm working on implementing a function in my Vue.js Firebase application that allows users to be deleted by UID. The app is designed to allow user registration through email and password authentication in Firebase. Once a user is logged in, they shoul ...

Sending a file from a VueJS application to a Laravel API

Currently, I am facing an issue while trying to upload an Excel sheet file from a front-end application built with VueJS to an API constructed with Laravel 5.5. The form request validation is indicating that "The file field is required", resulting in the f ...

What is the best way to apply color to a line-through click event in React without affecting the font color?

I'm attempting to change the click event on a line-through element to turn red when clicked, but I can't find any solutions. I've tried various methods with no success. Edit: After adding "color":"red" following "none", the line is now red, ...

Incorporating external JavaScript files into Angular component files

I have integrated a third-party JavaScript file into my app.component in the following manner: declare var MarvinJS: any; import { MarvinJS } from "../assets/js/marvinjslauncher.js"; Now, I am wondering if I can utilize the methods defined in marvinjslau ...

The UseEffect Async Function fails to execute the await function when the page is refreshed

Having trouble calling the await function on page refresh? Can't seem to find a solution anywhere. Here's the useEffect Code - useEffect(() => { fetchWalletAddress() .then((data) => { setWalletAddress(data); setLoa ...

I need these buttons to determine which div is displayed or appears "on top"

I am facing a challenge with the buttons on one side of my webpage and a main content area occupying most of the page. My goal is to make clicking a button change the main content to a div that contains relevant information. However, I have struggled to f ...

The error message appeared as a result of the bluebird and mongoose combination: TypeError: .create(...).then(...).nodeify is

Recently, I encountered an issue while attempting to integrate bluebird with mongoose. Here's the scenario: I wrote some test code using bluebird without incorporating mongoose, and it worked perfectly. The code looked something like this: A().then( ...

Strategies for successfully sharing MongoDB database connections between routes in NodeJS

I am trying to figure out how to pass the connection to mongo from index.js to other routes. I believe that creating a separate file with the necessary instructions for defining the database connection could be a solution, but I'm not sure how to impl ...

Using jQuery or Javascript to implement a drop-down list filter functionality

For the past two months, I've been struggling to figure out how to create a drop-down menu to filter content on the site I'm building for my boss. Despite countless searches online, I haven't found a solution that works. This is the only iss ...

Uninterrupted movement within a picture carousel

Seeking a way to create a smooth transition in an image slider with sliding dividers using continuous switching when clicking previous/next buttons. Currently, the dividers replace each other from far positions. Any ideas on achieving a seamless single mov ...

Is it possible to add a new document or parameter to the user.profile from the client in Meteor.js and Mongo?

Is it possible to insert an array of a user's links into the current user's profile? I attempted the following on the client side, but it did not work: Meteor.users.update( {_id: Meteor.userId()}, { $set: { profile: { ...

What is the best way to select the initial element from my class within my component using protractor?

Can anyone help me figure out how to click on the button in this component? I need guidance on navigating through the following path: Is xpath my only option for doing this? I believe a css locator could work as well, but I am unsure of how to construct ...

Restrict user access to certain routes in Laravel and Vue to maintain security

I have constructed a single-page application using Laravel and Vue, and I am trying to restrict user access to the /products/create route. Despite my attempts with Laravel middlewares, I have not been successful in achieving this restriction. Below is an ...

Is it possible to utilize array.push within the useEffect hook in React using Hooks?

I'm grappling with finding a solution to incorporating objects into my array. Take a look at the code below. export default function DashboardTable(props) { const { transactionData } = props; const classes = useStyles(); const [transaction ...

Updating the VueJS DOM when a different value is chosen from the dropdown menu

I am facing an issue with updating the DOM using the following logic: index.vue [Template Part] <div> <div v-for="obj in objects" :key="obj.id"> <select v-model="obj.quantity" @change="qtyChange(obj)"> < ...

Utilizing hover effects and timeouts to conditionally show React components

I encountered a challenging React layout dilemma. It's not a complex issue, but rather difficult to articulate, so I made an effort to be as clear as possible. The data I have maps individual components in the following way: map => <TableRow na ...

Determine the presence of a value within an array in mongodb

How can I determine if the current Meteor.user()._id exists in the "favoritedBy" array? If true, display "Your favorite", if false, display "Not your favorite". Here is an example document in MongoDB: { "_id" : "W5WwAZatorDEb6DNP", "createdBy" : "aT ...

Steps for styling an AngularJS Popup:1. Determine the desired appearance for

I have some code that displays a popup when clicked, along with its automatically generated CSS. I want to be able to make changes to the CSS by adding IDs or classes to it. How can I assign IDs or classes to this element so that I can easily target them f ...

What steps are involved in installing Angular 2 through NPM?

Currently, I am in the process of setting up my personal local development environment for an Angular 2 application without utilizing the QuickStart seed mentioned on the official Angular 2 website or the Angular CLI due to the surplus files that come with ...

The reactivity of Vue3 async composable export is not maintained

I am currently working on a Vue 3 composable that fetches navigation menus asynchronously. However, I am facing an issue where the exported values are not available when importing them in a component. I would like to find a way to be notified once these va ...