Currently, I am working on creating a dynamic view rendering using Vue and Laravel. However, I am facing difficulty in understanding how to pass the dynamic parameter to the component function.
Router.map({
'/cms-admin/:page': {
component: {
template: returnView(this.$route.params.page)
}
}
});
function returnView (option) {
// Perform the AJAX request here
}
After going through several documentations, I have learned that $route can solve this issue. I can incorporate $route into the view and display the text on the page. But I'm struggling to use $route within the map function to retrieve the dynamic name?
For instance, if I input "/cms-admin/dashboard", 'dashboard' should be extracted for the template parameters.
Thank you in advance, Steven