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,
...@@ -9,33 +9,34 @@ export default { ...@@ -9,33 +9,34 @@ export default {
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()
return
} }
if (this.$route.meta.isTab) this.init() if (this.$route.meta.isTab) this.init()
}, },
methods: { methods: {
init() { init () {
this.showLoading() this.showLoading()
let { tabIndex, pageNum } = this let { tabIndex, pageNum } = this
this[`getList_${tabIndex}`](pageNum) this[`getList_${tabIndex}`](pageNum)
}, },
change(index) { change (index) {
this.tabIndex = index this.tabIndex = index
this.clearData() this.clearData()
}, },
clearData() { clearData () {
this.flag = false this.flag = false
this.pageNum = 1 this.pageNum = 1
this.list = [] this.list = []
if (this.$refs.scrollView) this.$refs.scrollView.finished = false if (this.$refs.scrollView) this.$refs.scrollView.finished = false
this.init() this.init()
}, },
onReachBottom() { onReachBottom () {
let { total, pageNum, list } = this let { total, pageNum, list } = this
this.$refs.scrollView.loading = false this.$refs.scrollView.loading = false
if (list.length == total) { if (list.length == total) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!