Skip to content

Commit

Permalink
dialog-item 可以多个弹窗 更改数据获取方式
Browse files Browse the repository at this point in the history
  • Loading branch information
bigrocs committed Sep 13, 2017
1 parent acca2f8 commit 21e3632
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
5 changes: 1 addition & 4 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const state = {
api:{
sidebar: ''
},
dialog: {
postData: null,
apiUrl: null,
}
dialog: {}
}
export default new Vuex.Store({
state,
Expand Down
1 change: 1 addition & 0 deletions src/store/mutation-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
6 changes: 4 additions & 2 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 21e3632

Please sign in to comment.