In my Main.js file, I am currently fetching routes from the database using an API call. However, I've run into an issue with Vue router version 4 deprecating the addRoutes
functionality. Now, I can only add one route at a time which is not ideal for me to iterate through the routes/menu list. I'm seeking advice on how to overcome this challenge.
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");