Answer the question
In order to leave comments, you need to log in
How to wrap a vue object in a Promise?
I want to make a dialogue on vue.js with a return value.
It turns out something like this:
static changeSizeDialog(direction, currentValue){
return new Promise((resolve, reject) => {
const dialog = new Vue({
el: '#dialogChangeSize',
data: {
show: true,
direction: direction,
value: currentValue,
},
methods:{
closeDialog(){
this.show = false;
dialog.$destroy();
dialog.$el.remove();
},
setSize: function(value){
this.closeDialog();
resolve(value);
}
}
});
});
}
Aperture.dialogChangeSize(param1, param2).then((result) => {...})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question