Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Vue.js confirm mixin
module.exports = {
methods: {
confirm(message, callback) {
if (window.confirm(message)) {
let confirm = require('./mixins/confirm.js');
Vue.component('my-component', {
mixins: [confirm],
methods: {
onSomeEvent() {
let message = 'Are you sure you wish to do this?';
this.confirm(message, () => {
// Do something if user confirms action

This comment has been minimized.

Copy link
Owner Author

martinbean commented Nov 27, 2017

Vue.js mixin that lets you execute a callback if the user confirms an action.

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.