From 21e36321323edc4cc4c7e162cc14508c3b19187e Mon Sep 17 00:00:00 2001 From: bigrocs Date: Wed, 13 Sep 2017 14:27:28 +0800 Subject: [PATCH] =?UTF-8?q?dialog-item=20=E5=8F=AF=E4=BB=A5=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=BC=B9=E7=AA=97=20=E6=9B=B4=E6=94=B9=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/actions.js | 3 +++ src/store/index.js | 5 +---- src/store/mutation-types.js | 1 + src/store/mutations.js | 6 ++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/store/actions.js b/src/store/actions.js index 2b303bc..4b1bf77 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -47,3 +47,6 @@ export const callbackData = ({ commit,state }, data) => { export const dialog = ({ commit,state }, {apiUrl, postData}) => { commit(types.DIALOG, {apiUrl, postData}) } +export const deleteDialog = ({ commit,state }, apiUrl) => { + commit(types.DELETE_DIALOG, apiUrl) +} diff --git a/src/store/index.js b/src/store/index.js index 56a2a2c..c00f4f0 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -20,10 +20,7 @@ const state = { api:{ sidebar: '' }, - dialog: { - postData: null, - apiUrl: null, - } + dialog: {} } export default new Vuex.Store({ state, diff --git a/src/store/mutation-types.js b/src/store/mutation-types.js index 50bc763..b8710bd 100644 --- a/src/store/mutation-types.js +++ b/src/store/mutation-types.js @@ -2,4 +2,5 @@ export const SET_MAIN_DATA = 'SET_MAIN_DATA' export const SET_SIDEBAR = 'SET_SIDEBAR' export const CALLBACK_DATA = 'CALLBACK_DATA' export const DIALOG = 'DIALOG' +export const DELETE_DIALOG = 'DELETE_DIALOG' export const CALLBACK_ERROR = 'CALLBACK_ERROR' diff --git a/src/store/mutations.js b/src/store/mutations.js index 8a560c3..7b077a3 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -10,8 +10,10 @@ export default { state.callbackData = data }, [types.DIALOG] (state, {apiUrl, postData}){ - state.dialog.apiUrl = apiUrl - state.dialog.postData = postData + Vue.set(state.dialog,apiUrl,postData) + }, + [types.DELETE_DIALOG] (state, apiUrl){ + Vue.delete(state.dialog,apiUrl) }, [types.CALLBACK_ERROR] (state, error){ state.callbackError = error