Vue.js, pass data to component on another route

Asked By: Anonymous

Simple task to pass data from one page to another made a real headache to newbie in Vue.js
Here is my router
enter image description here

I’m rendering a form on “/” page, which make an API request,
enter image description here

and I just want to pass data to another route page with another component
enter image description here

Is it so hard to do in Vue? It made a real headache for me today.
Get data from API, save & send to another component. How can I do it?


Solution

Answered By: Anonymous

As Antony said, since you’ve already enabled props in router/index.js, you can pass parameters in router.push like this:

router.push({
    name: 'events',
    params: {
        items: data
    }
});

then you will be able to receive items as props in EventsDisplay.vue

export default {
    name: 'eventsDisplay',
    props: ['items'],
};

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno