log 模块优化
Former-commit-id: 46dd58602044e544021e6dac3750f8063dd8f630 [formerly 46dd58602044e544021e6dac3750f8063dd8f630 [formerly 46dd58602044e544021e6dac3750f8063dd8f630 [formerly 46dd58602044e544021e6dac3750f8063dd8f630 [formerly 02da1cf89a30a31b7ada6753276bf8d7db49c7c2 [formerly 8732cbe9dc0937266a143b0cb94061cc6458c22f]]]]] Former-commit-id: 9bb0587d2bf29ae030c34e973b2968898c409efa Former-commit-id: 4573b85856d998f1e0e1fc745aa84c116374b757 Former-commit-id: 499c55cf76d4187c091b3780fc492b863b20160a [formerly 522496547f9dcaeb7cceff1c71ca90d19fa853ce] Former-commit-id: 76cf33d5c5abb90f90715e0678987996286b8e7a Former-commit-id: c5601273186197e17715589beec00fa4b0d93c8f Former-commit-id: 2057049057822377d125e273d901e9e0b01d3d99 Former-commit-id: 4a45cde995408c9e2de7028e9335c72a57f93530 Former-commit-id: b8a74a0c8dca434b6dd43606d97cebb396bc36c0
This commit is contained in:
@@ -11,7 +11,7 @@ export default {
|
||||
// - type 非必须 类型 success | warning | info | error
|
||||
// - time 必须 日志记录时间
|
||||
// - meta 非必须 其它携带信息
|
||||
list: []
|
||||
log: []
|
||||
},
|
||||
getters: {
|
||||
/**
|
||||
@@ -19,14 +19,14 @@ export default {
|
||||
* @param {*} state vuex state
|
||||
*/
|
||||
length (state) {
|
||||
return state.list.length
|
||||
return state.log.length
|
||||
},
|
||||
/**
|
||||
* @description 返回现存 log (error) 的条数
|
||||
* @param {*} state vuex state
|
||||
*/
|
||||
lengthError (state) {
|
||||
return state.list.filter(l => l.type === 'error').length
|
||||
return state.log.filter(l => l.type === 'error').length
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -36,8 +36,8 @@ export default {
|
||||
* @param {String} param type {String} 类型
|
||||
* @param {Object} param meta {Object} 附带的信息
|
||||
*/
|
||||
add ({ rootState, commit }, { message, type, meta }) {
|
||||
commit('add', {
|
||||
push ({ rootState, commit }, { message, type, meta }) {
|
||||
commit('push', {
|
||||
message,
|
||||
type,
|
||||
time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
@@ -62,8 +62,8 @@ export default {
|
||||
* @param {Object} state vuex state
|
||||
* @param {Object} log data
|
||||
*/
|
||||
add (state, log) {
|
||||
state.list.push(log)
|
||||
push (state, log) {
|
||||
state.log.push(log)
|
||||
},
|
||||
/**
|
||||
* @description 清空日志
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
*/
|
||||
clean (state) {
|
||||
// store 赋值
|
||||
state.list = []
|
||||
state.log = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user