Skip to content

Commit bb174e9

Browse files
committed
🎨 周期顺序规范
1 parent 4322007 commit bb174e9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pages/search/index.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@
1616
import reachBottom from '~/mixins/reachBottom'
1717
1818
export default {
19-
head () {
20-
return {
21-
title: `${this.$route.query.keyword} - 搜索 - 掘金`
22-
}
23-
},
24-
watchQuery: ['keyword', 'type', 'period'],
25-
validate ({ query }) {
26-
let types = [undefined, 'all', 'article', 'tag', 'user']
27-
let periods = [undefined, 'all', 'd1', 'w1', 'm3']
28-
if (types.includes(query.type) && periods.includes(query.period)) {
29-
return true
30-
}
31-
return false
32-
},
3319
async asyncData({ app, query }) {
3420
let res = await app.$api.searchList({
3521
after: 0,
@@ -43,6 +29,20 @@ export default {
4329
searchList: res.edges || []
4430
}
4531
},
32+
head () {
33+
return {
34+
title: `${this.$route.query.keyword} - 搜索 - 掘金`
35+
}
36+
},
37+
validate ({ query }) {
38+
let types = [undefined, 'all', 'article', 'tag', 'user']
39+
let periods = [undefined, 'all', 'd1', 'w1', 'm3']
40+
if (types.includes(query.type) && periods.includes(query.period)) {
41+
return true
42+
}
43+
return false
44+
},
45+
watchQuery: ['keyword', 'type', 'period'],
4646
mixins: [reachBottom],
4747
data() {
4848
return {

0 commit comments

Comments
 (0)