index.js 624 Bytes
import actions from './actions';
import mutations from './mutations';

function handleNum(n) {
  return n > 99 ? '99+' : n;
}

export default function() {
  return {
    namespaced: true,
    state: {
      fetching: false,
      yohoList: {
        notuse: [],
        use: [],
        overtime: []
      },
      num: {
        notuse: 0,
        use: 0,
        overtime: 0
      },
      ufoList: [],
      filterList: [],
    },
    actions,
    mutations,
    getters: {
      getNum(state) {
        return [handleNum(state.num.notuse), handleNum(state.num.use), handleNum(state.num.overtime)];
      },
    }
  };
}