vue-final-modal
vue-final-modal copied to clipboard
cant access outter this in events
Hi, awesome Plugin
"nuxt": "^2.15.8", "vue-final-modal": "^2.4.1",
i try to access this .deleteItem(row.id) but it says Cannot read properties of null (reading 'deleteItem') An error occurred while rendering the page
but when i make with _self = this then it works
Works:
deleteProduct({ row }) {
const _self = this; // i have todo this
this.$vfm.show({
component: ConfirmationModal,
bind: {
title: `Delete Product: ${row.title}`,
text: this.$t('You can restore the product at any time.'),
},
on: {
async confirm(close) {
await _self.deleteItem(row.id);
close();
},
cancel(close) {
close();
},
},
});
},
Not WOrking:
deleteProduct({ row }) {
this.$vfm.show({
component: ConfirmationModal,
bind: {
title: `Delete Product: ${row.title}`,
text: this.$t('You can restore the product at any time.'),
},
on: {
async confirm(close) {
await this.deleteItem(row.id);
close();
},
cancel(close) {
close();
},
},
});
},