I'm currently working on a webshop using Vue.js. When I add products, I utilize an event bus to pass the data to the CartComponent. Everything works as expected; however, if I navigate back or reload the page, all the data in my CartComponent gets deleted. How can I prevent this from happening?
I've attempted to wrap the component with
<keep-alive>
<CartComponent />
</keep-alive>
But that doesn't seem to be solving the issue. Could someone advise me on how to ensure that the component retains its data even when changing routes?