I am currently attempting to utilize Vue Ant's confirmation modal dialog, but I am encountering difficulties in accessing methods and data within the onOk
prop. Whenever I try to call my methods or use this.$emit
, I receive an error message stating "TypeError: Cannot read property '$emit' of undefined". I am seeking guidance on how to properly access my methods and data inside the onOk
prop for this component.
deleteCampaign() {
this.$confirm({
title: `Are you sure you want to delete ${this.campaign.name}?`,
content: 'This will permanently delete the campaign and all associated info.',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
iconType: 'warning',
onOk() {
this.$emit('delete-campaign', this.campaign.pk);
},
onCancel() {},
});
}