Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 有承诺的Vuex模式?_Javascript_Vue.js_Modal Dialog_Vuex - Fatal编程技术网

Javascript 有承诺的Vuex模式?

Javascript 有承诺的Vuex模式?,javascript,vue.js,modal-dialog,vuex,Javascript,Vue.js,Modal Dialog,Vuex,我目前在我的根应用程序上有一个模式,可以监视vuex状态的更改,并相应地显示/隐藏内容,如下所示: // inside my modal computed: { modal() { return this.$store.state.modal } } 在我需要启动模态的任何组件中。我只需要像这样改变模态状态 this.$store.commit( 'updateModal', { title: 'this is the modal title', message: 'this

我目前在我的根应用程序上有一个模式,可以监视vuex状态的更改,并相应地显示/隐藏内容,如下所示:

// inside my modal
computed: {
 modal() {
  return this.$store.state.modal
 }
}
在我需要启动模态的任何组件中。我只需要像这样改变模态状态

this.$store.commit( 'updateModal',
 {
  title: 'this is the modal title',
  message: 'this is the modal message.'
 }
)
这一切都很好。但是如果我想让OK和cancel按钮运行一些功能。我在想我该怎么做。我认为最好的方法是让模态返回一个resolve或reject,这样我的组件就可以继续它自己的功能了。但是我不知道如何连接它,因为我的模态和我的组件是分开的