index.js 654 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: 20,
        use: 100,
        overtime: 1000
      },
      ufoList: [],
      filterList: [],
      showFilter: true,
    },
    actions,
    mutations,
    getters: {
      getNum(state) {
        return [handleNum(state.num.notuse), handleNum(state.num.use), handleNum(state.num.overtime)];
      },
    }
  };
}