Skip to content

Commit 21e3632

Browse files
committed
dialog-item 可以多个弹窗 更改数据获取方式
1 parent acca2f8 commit 21e3632

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/store/actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ export const callbackData = ({ commit,state }, data) => {
4747
export const dialog = ({ commit,state }, {apiUrl, postData}) => {
4848
commit(types.DIALOG, {apiUrl, postData})
4949
}
50+
export const deleteDialog = ({ commit,state }, apiUrl) => {
51+
commit(types.DELETE_DIALOG, apiUrl)
52+
}

src/store/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ const state = {
2020
api:{
2121
sidebar: ''
2222
},
23-
dialog: {
24-
postData: null,
25-
apiUrl: null,
26-
}
23+
dialog: {}
2724
}
2825
export default new Vuex.Store({
2926
state,

src/store/mutation-types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export const SET_MAIN_DATA = 'SET_MAIN_DATA'
22
export const SET_SIDEBAR = 'SET_SIDEBAR'
33
export const CALLBACK_DATA = 'CALLBACK_DATA'
44
export const DIALOG = 'DIALOG'
5+
export const DELETE_DIALOG = 'DELETE_DIALOG'
56
export const CALLBACK_ERROR = 'CALLBACK_ERROR'

src/store/mutations.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ export default {
1010
state.callbackData = data
1111
},
1212
[types.DIALOG] (state, {apiUrl, postData}){
13-
state.dialog.apiUrl = apiUrl
14-
state.dialog.postData = postData
13+
Vue.set(state.dialog,apiUrl,postData)
14+
},
15+
[types.DELETE_DIALOG] (state, apiUrl){
16+
Vue.delete(state.dialog,apiUrl)
1517
},
1618
[types.CALLBACK_ERROR] (state, error){
1719
state.callbackError = error

0 commit comments

Comments
 (0)