[Vuejs]-Vue Router how to substitute data from input to url

0👍

If you use vue router, you can add some routes, for example :

        {
            name: "doc-create",
            path: "backend/docs/create",
            component: () => import("@/views/backend/doc/Create.vue"),
        },
        {
            name: "doc-view",
            path: "backend/docs/:id",
            component: () => import("@/views/backend/doc/View.vue"),
        },

/doc/:id means id is a parameter
Then in your vue file, in script you can retrieve id with : $route.params.id

Leave a comment