getters.js 302 B

123456789101112131415
  1. export const count = state => state.count
  2. export const t = (state) => {
  3. return state.test
  4. }
  5. const limit = 5
  6. export const recentHistory = state => {
  7. const end = state.history.length
  8. const begin = end - limit < 0 ? 0 : end - limit
  9. return state.history
  10. .slice(begin, end)
  11. .join(', ')
  12. }