Skip to content

Commit b9bfdd8

Browse files
eliurkisyyx990803
authored andcommitted
Refactor code (vuejs#195)
1 parent 253a3aa commit b9bfdd8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/store/getters.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ export default {
33
// current list type and current pagination
44
activeIds (state) {
55
const { activeType, itemsPerPage, lists } = state
6-
const page = Number(state.route.params.page) || 1
7-
if (activeType) {
8-
const start = (page - 1) * itemsPerPage
9-
const end = page * itemsPerPage
10-
return lists[activeType].slice(start, end)
11-
} else {
6+
7+
if (!activeType) {
128
return []
139
}
10+
11+
const page = Number(state.route.params.page) || 1
12+
const start = (page - 1) * itemsPerPage
13+
const end = page * itemsPerPage
14+
15+
return lists[activeType].slice(start, end)
1416
},
1517

1618
// items that should be currently displayed.

0 commit comments

Comments
 (0)