Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Promise-based Vue.js confirmation dialog mixin
import confirm from './confirm';
export default {
mixins: [
confirm
],
methods: {
onDelete() {
this.confirm('Are you sure you wish to delete this item?').then(() => {
// Delete item
});
}
}
}
export default {
methods: {
confirm(message) {
return new Promise((resolve, reject) => {
confirm(message) ? resolve() : reject();
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.