Added mixin for preview-hiding modal confirmations
This commit is contained in:
parent
6067f5f7d0
commit
7fd0791108
1 changed files with 28 additions and 0 deletions
28
src/main.js
28
src/main.js
|
|
@ -2,8 +2,36 @@ import Vue from 'vue'
|
|||
import App from './App.vue'
|
||||
import store from './store'
|
||||
|
||||
import UIkit from 'uikit';
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
modalConfirm: function(modalText) {
|
||||
var self = this;
|
||||
|
||||
// Stop GPU preview to show modal
|
||||
self.$root.$emit('globalTogglePreview', false)
|
||||
|
||||
var showModal = function(resolve, reject) {
|
||||
UIkit.modal.confirm(modalText)
|
||||
.then(function() {
|
||||
resolve()
|
||||
}, function () {
|
||||
reject()
|
||||
})
|
||||
.finally(function() {
|
||||
// Reenable the GPU preview, if it was active before the modal
|
||||
console.log("Re-enabling GPU preview")
|
||||
self.$root.$emit('globalReenablePreview')
|
||||
})
|
||||
}
|
||||
return new Promise(showModal)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
new Vue({
|
||||
store,
|
||||
render: h => h(App)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue