This commit is contained in:
2018-11-16 19:12:56 +00:00
parent c7ee8923b6
commit 71483ec841

View File

@@ -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
);
}
}
},