This is my Main.js. I'm fetching routes from the database through an API call but Vue router version 4 deprecated addRoutes
functionality. So now I can add only one route at a time. I don't want to add routes by iterating the routes/menu list. Please share your thoughts.
new Vue({
store,
router,
render: h => h(App),
beforeMount() {
if (this.menuList.length) {
this.$router.addRoutes(this.menuList);
}
},
computed: {
...mapGetters({
menuList: "menuStore/menuList"
})
},
}).$mount("#app");