What should I do when there are too many routes in Vue-router (am I writing this correctly?)

clipboard.png

clipboard.png

as there are more and more routes, more and more components are introduced into router.js, and each particular page corresponds to a different component.
is this a reasonable way to write? It feels weird


to improve maintainability. You can split it into multiple files according to the page, which is nothing more than importing and exporting a routing object.


if the page structure is exactly or almost the same, try routing parameters, or dynamic routing.


Let me answer in more detail

there is a router.js, outside and each module of pages has its own router.js

the outer one is only responsible for loading the inner one. Add

via router.addRoutes .

what is in the module is where the routing is configured

it is also important to use import to dynamically load routes

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3e138-434b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3e138-434b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?