Can vue-router return data to generate routing information at the back end?

it"s too inelegant and difficult to maintain all routes written in front-end code. If you want to store all the routing information in the database, use the back-end return data to dynamically generate the front-end route.

example code is as follows:
where routesData is the parameter instantiated by routing new Router

for (let i of data) {`````
    every = {
        path: i["path"],
        name: i["name"],
        component: () => import(i["src"]),
    }
    routesData.push(every)
}

but the above idea can not be realized, check the reason, import does not seem to support variables, broken eggs.
I do not know if my idea can be realized, is there a boss to solve the problem?


just read the Big Boss's article hand-touch, take you to use vue to do background Series 2 (login permissions section)

there is no special need to honestly write the route to the front end. If you write it into the interface, you will make trouble with yourself.

Menu