0

I don't understand what is wrong with Vue (3) Router. I created this dynamic path:

    path: "/edit/:id",
    name: "Edit",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/Edit.vue"),
  },

and when I pass myapp.com/edit/123 to the address bar, the view is rendered correctly and I can use the id in the code, however I get this warn Router warn]: No match found for location with path 2 times

Instead, if I do not pass any segment id, but I just try to open myapp.com/edit the view is not rendered and I still get the same warning 3 times.

I dont get what is going wrong...

1 Answer 1

1

Ok well, it was an easy fix. By just adding a question mark after the parameter, it becomes optional and the warning disappears path: "/edit/:id? 😂

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.