I'm kinda confused how to go about this since the project is built in php partly.
In my app.js i just created a new vue route:
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/order/${order.id}',
name: 'order',
component: OrderDetails,
props: true,
},
],
});
new Vue({
render: (h) =>
h(InertiaApp, {
props: {
initialPage: JSON.parse(app.dataset.page),
resolveComponent: (name) => require(`./Pages/${name}`).default,
},
}),
router,
}).$mount(app);
My method to push to the router:
onOrderClick: function (order) {
console.log('clicked', order.id)
this.$router.push(`/order/${order.id}`);
},
Currently whenever i click an order only the url changes to the following:
How can i now render the component with the order as a prop.
Do i need to define the route in the php routes/web.php aswell to render it?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…