Skip to content

Commit

Permalink
调整格式
Browse files Browse the repository at this point in the history
  • Loading branch information
wodb committed Aug 2, 2018
1 parent 1112f0f commit 55e3aab
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
11 changes: 9 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,22 @@
}
},
mounted() {
window.addEventListener('scroll',handleScroll.bind(this))
window.addEventListener('scroll',debounce(this.handleScroll,500))
},
destroyed() {
window.removeEventListener('scroll',handleScroll.bind(this))
window.removeEventListener('scroll',debounce(this.handleScroll,500))
},
methods: {
handleSelect(key, keyPath) {
console.log(key, keyPath)
},
handleScroll(){
if (document.documentElement.scrollTop >= 200) {
this.top = true
}else {
this.top = false
}
},
goTop() {
let timer = null
const doc = document.documentElement
Expand Down
10 changes: 5 additions & 5 deletions src/pages/index/special_column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default {
},
computed: {
recommends() {
return this.$store.state.app.indexList[this.type];
return this.$store.state.app.indexList[this.type];
}
},
mounted() {
Expand All @@ -63,10 +63,10 @@ export default {
fetchList:'FETCH_INDEX_LIST_BY_TYPE'
}),
handleClick(e) {
this.$message({
message: '暂未实现此功能',
type: 'warning'
})
this.$message({
message: '暂未实现此功能',
type: 'warning'
})
},
onscroll() {
const doc = document.documentElement
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index/top.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default {
},
computed: {
recommends() {
return this.$store.state.app.indexList[this.type];
return this.$store.state.app.indexList[this.type];
}
},
mounted() {
Expand Down
10 changes: 3 additions & 7 deletions src/store/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ const app = {
return res
})
},
FETCH_INDEX_LIST_BY_TYPE({ commit }, { type }) {
let p = null
if (type == 'top') {
p = fetchRecommendByType(type)
} else {
p = fetchEntriesByType(type)
}
FETCH_INDEX_LIST_BY_TYPE({ commit }, { type, token }) {
let p = type == 'top' ? fetchRecommendByType(type) : fetchEntriesByType(type)

return p
.then(res => {
commit('SET_INDEX_LIST', { type, data: res })
Expand Down

0 comments on commit 55e3aab

Please sign in to comment.