One solution to this problem is to use an event bus to communicate between the two components.
First, create a new Vue instance as an event bus in your main.js file:
window.EventBus = new Vue();
Then, in your Bet component, emit an event when a bet is clicked:
methods: {
selectBet(bet) {
EventBus.$emit('betSelected', bet);
}
}
In your Ticket component, listen for this event and store the selected bet in localStorage:
created() {
EventBus.$on('betSelected', (bet) => {
// store bet in localStorage
});
}
This way, when a bet is clicked in the Bet component, it emits an event that the Ticket component is listening for and can then store the selected bet in localStorage.