This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
import createPersistedState from "vuex-persistedstate";
|
||||
import _ from "./utils/libs/core.min.js";
|
||||
import _ from "./utils/libs/lodash.js";
|
||||
|
||||
const MaxLogLength = 3;
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
@@ -46,8 +48,11 @@ export default new Vuex.Store({
|
||||
logItem(state, msg) {
|
||||
msg = Date.now() + "|" + msg;
|
||||
state.logArray.push(msg);
|
||||
if (state.logArray.length > 100) {
|
||||
_.drop(state.logArray);
|
||||
if (state.logArray.length > MaxLogLength) {
|
||||
state.logArray = _.drop(
|
||||
state.logArray,
|
||||
state.logArray.length - MaxLogLength
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user