44 lines
865 B
JavaScript
44 lines
865 B
JavaScript
/*
|
|
* @Descripttion:
|
|
* @version:
|
|
* @Date: 2021-04-21 09:18:32
|
|
* @LastEditors: huzhushan@126.com
|
|
* @LastEditTime: 2021-04-21 09:34:13
|
|
* @Author: huzhushan@126.com
|
|
* @HomePage: https://huzhushan.gitee.io/vue3-element-admin
|
|
* @Github: https://github.com/huzhushan/vue3-element-admin
|
|
* @Donate: https://huzhushan.gitee.io/vue3-element-admin/donate/
|
|
*/
|
|
const state = {
|
|
logs: [],
|
|
}
|
|
|
|
const mutations = {
|
|
ADD_ERROR_LOG: (state, log) => {
|
|
state.logs.push(log)
|
|
},
|
|
CLEAR_ERROR_LOG: state => {
|
|
state.logs.splice(0)
|
|
},
|
|
}
|
|
|
|
const actions = {
|
|
addErrorLog({ commit }, log) {
|
|
// 可以根据需要将错误上报给服务器
|
|
// ....code.......
|
|
|
|
// 触发mutations
|
|
commit('ADD_ERROR_LOG', log)
|
|
},
|
|
clearErrorLog({ commit }) {
|
|
commit('CLEAR_ERROR_LOG')
|
|
},
|
|
}
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
mutations,
|
|
actions,
|
|
}
|