I have a component that on click calls a function that does things in the store:
<button @click="this.store.foo()"></button>
And in the store I change this property:
state: () => ({
focusIn: false,
}),
actions: {
foo() {
this.focusIn = true;
}
}
Now how do I make sure that when I change this focusIn property in the store, it sets the focus to an input in a component other than MyComponent?
2
Answers
you can add a templete ref on the button and use it to trigger the focus() function.
And in your pinia store
You can try this: