var MessageBox = function (data) { return new Promise(function (resolve, reject) { var vue = new Vue({ el: '#component', data: function () { return data }, template: `
`, methods: { handleOk: function () { console.log('done') resolve() this.$destroy(true) }, handleCancel: function () { this.$destroy(true) } } }) }) } MessageBox({message: '23333'}).then(function () {console.log('callback')})