How to make dynamic routes on the vue router?

I suppose getDetailMenu is calling API method to get listMenu. You can create route dynamically using addRoutes method Pseudo code created() { this.getDetailMenu(this.$route.path) .then((listMenu) => { // you need to return listMenu from getDetailMenu listMenu.forEach((item, index) => createAndAppendRoute(item, index)) }) }, methods: { createAndAppendRoute: (item, index) => { console.log(item, index) // Base on your data, … Read more