|
@@ -34,9 +34,17 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="alert-text" v-show="this.dataList.length>=this.dataTotal">
|
|
|
|
+ <div>没有更多数据</div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<style scoped>
|
|
<style scoped>
|
|
|
|
+.alert-text{
|
|
|
|
+ text-align: center;
|
|
|
|
+ font-size: 0.3rem;
|
|
|
|
+ color: #999;
|
|
|
|
+}
|
|
.tv-list .tv-item {
|
|
.tv-list .tv-item {
|
|
border-bottom: 1px solid #ccc;
|
|
border-bottom: 1px solid #ccc;
|
|
padding-bottom: 0.2rem;
|
|
padding-bottom: 0.2rem;
|
|
@@ -114,7 +122,8 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
dataList: [],
|
|
dataList: [],
|
|
- isLoading:false
|
|
|
|
|
|
+ isLoading:false,
|
|
|
|
+ dataTotal: 0
|
|
};
|
|
};
|
|
},
|
|
},
|
|
beforeMount() {
|
|
beforeMount() {
|
|
@@ -128,6 +137,9 @@ export default {
|
|
mounted() {
|
|
mounted() {
|
|
this.scrollHandle();
|
|
this.scrollHandle();
|
|
},
|
|
},
|
|
|
|
+ beforeDestroy() {
|
|
|
|
+ window.onscroll = null;
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
// 获取数据
|
|
// 获取数据
|
|
getData() {
|
|
getData() {
|
|
@@ -140,7 +152,7 @@ export default {
|
|
},
|
|
},
|
|
})
|
|
})
|
|
.then((res) => {
|
|
.then((res) => {
|
|
- // console.log(res);
|
|
|
|
|
|
+ this.dataTotal = res.data.total;
|
|
this.dataList = this.dataList.concat(res.data.subject_collection_items);
|
|
this.dataList = this.dataList.concat(res.data.subject_collection_items);
|
|
setTimeout(()=>{
|
|
setTimeout(()=>{
|
|
this.isLoading = false;
|
|
this.isLoading = false;
|
|
@@ -162,7 +174,7 @@ export default {
|
|
let scrollHeight = dom.scrollHeight;
|
|
let scrollHeight = dom.scrollHeight;
|
|
if (scrollTop + clientHeight + 100 >= scrollHeight) {
|
|
if (scrollTop + clientHeight + 100 >= scrollHeight) {
|
|
console.log("到底了");
|
|
console.log("到底了");
|
|
- if(!this.isLoading){
|
|
|
|
|
|
+ if(!this.isLoading && this.dataTotal>this.startNum){
|
|
this.startNum += 10;
|
|
this.startNum += 10;
|
|
this.getData();
|
|
this.getData();
|
|
}
|
|
}
|