-1👍
You can do 3 things:
- Make a counter store with pinia to mutate the counter state from anywhere
- Install mitt (npm install –save mitt), to emitt and receive events from anywhere and update your component on(‘productAdded’)
- Create a ref to the CounterComponent to access directly to the component properties from the parent,
like following:
JS
const counterRef = ref()
Template
<CounterComponent ref='counterRef' />
And then in the span event handler:
counterRef.count = 1;
Source:stackexchange.com