Commit b22a2565 by 李伟康

commit

1 parent 112c52c8
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
title-inactive-color="#BBB" title-inactive-color="#BBB"
title-active-color="#2c2c2c" title-active-color="#2c2c2c"
@click="click" @click="click"
:key="updata"
> >
<template v-for="(i,index) in data"> <template v-for="(i,index) in data">
<van-tab <van-tab
...@@ -33,7 +32,10 @@ export default { ...@@ -33,7 +32,10 @@ export default {
type: Number, type: Number,
default: 0 default: 0
}, },
updata: null updata: {
type: Number,
default: new Date().getTime()
}
}, },
data () { data () {
return { return {
......
export default { export default {
data() { data () {
return { return {
tabIndex: 0, tabIndex: 0,
pageNum: 1, pageNum: 1,
list: [], list: [],
total: 0, total: 0,
flag: false, flag: false,
updata: new Date().getTime() updata: new Date().getTime()
} }
}, },
mounted() { mounted () {
let { tabIndex } = this.getQuery() let { tabIndex } = this.getQuery()
if (tabIndex) { if (tabIndex) {
this.tabIndex = Number(tabIndex) this.tabIndex = Number(tabIndex)
this.updata = new Date().getTime() this.updata = new Date().getTime()
} this.init()
if (this.$route.meta.isTab) this.init() return
}
}, if (this.$route.meta.isTab) this.init()
methods: { },
init() { methods: {
this.showLoading() init () {
let { tabIndex, pageNum } = this this.showLoading()
this[`getList_${tabIndex}`](pageNum) let { tabIndex, pageNum } = this
}, this[`getList_${tabIndex}`](pageNum)
change(index) { },
this.tabIndex = index change (index) {
this.clearData() this.tabIndex = index
}, this.clearData()
clearData() { },
this.flag = false clearData () {
this.pageNum = 1 this.flag = false
this.list = [] this.pageNum = 1
if (this.$refs.scrollView) this.$refs.scrollView.finished = false this.list = []
this.init() if (this.$refs.scrollView) this.$refs.scrollView.finished = false
}, this.init()
onReachBottom() { },
let { total, pageNum, list } = this onReachBottom () {
this.$refs.scrollView.loading = false let { total, pageNum, list } = this
if (list.length == total) { this.$refs.scrollView.loading = false
this.$refs.scrollView.finished = true if (list.length == total) {
return this.$refs.scrollView.finished = true
} return
if (Math.ceil(total / 10) > pageNum) { }
this.pageNum = pageNum + 1 if (Math.ceil(total / 10) > pageNum) {
this.init() this.pageNum = pageNum + 1
} else { this.init()
this.$refs.scrollView.finished = true } else {
} this.$refs.scrollView.finished = true
} }
} }
}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!