0👍
countdowns
shouldn’t be reassigned, it’s a constant and it can’t be reactive the other way.
The problem here is that it was destructured from the state without a good reason.
It should be either:
const main = useCountdownStore();
const deleteCountdown = (e) => {
main.countdowns = main.countdowns.filter((countdown) => {
countdown.id != e.targt.parentElement.id;
});
};
Or used as a ref:
const main = useaCountdownStore();
const { countdowns } = toRefs(main);
const deleteCountdown = (e) => {
countdowns.value = countdowns.value.filter((countdown) => {
countdown.id != e.targt.parentElement.id;
});
};
deleteCountdown
itself implements store logic outside the store, it should preferably be transformed to store action.
- [Vuejs]-How to insert other values into table column Vue3 Element-plus
- [Vuejs]-How to solve this GOOGLE_APPLICATION_CREDENTIALS problem in Firebase hosting with GitHub action CICD
Source:stackexchange.com