You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
804 B

import Confirm from './vuetify-confirm.component'
function install (Vue, options) {
const property = (options && options.property) || '$confirm'
function createDialogCmp (options) {
return new Promise((resolve) => {
const cmp = new Vue(Object.assign({}, Confirm, {
propsData: Object.assign({}, Vue.prototype.$confirm.options, options),
destroyed: (c) => {
document.body.removeChild(cmp.$el)
resolve(cmp.value)
}
}))
console.log(cmp.$mount())
// document.body.appendChild(cmp.$mount().$el)
})
}
function show (message, options = {}) {
options.message = message
return createDialogCmp(options)
}
Vue.prototype[property] = show
Vue.prototype[property].options = options || {}
}
export default { install }