we can able to pass the function as a variable in the child module like the below code.
Automated-payment.vue
<ListOptionsFilter @selected=”handleSelection” />
methods: {
handleSelection(value) {
this.selectedValue = value;
this.Statement = [];
},
}
ListOptionsFilter.vue
methods: {
handleSelection(event) {
const selectedType = event.target.value;
this.$emit(‘selected’, selectedType);
this.currentAccounts = this.accountList.filter(account => {
if (selectedType === ‘Bank’) {
return account.type === ‘Bank’;
} else if (selectedType === ‘Credit’) {
return account.type === ‘CredCard’;
}
return false;
});
this.selectedAccounts = null; // Reset selected account when type changes
},
}