Authored by ccbikai

资讯加载数据优化

<template>
<resources v-bind:content-code.sync="contentCode"></resources>
<div v-infinite-scroll="getNewsList()" infinite-scroll-disabled="scrollDisabled">
<div v-infinite-scroll="getNewsList()">
<div v-for="editorial in editorialList" class="editorial-box">
<div class="img">
<a href='{{"/editorial/" + editorial.id + ".html"}}'>
... ... @@ -93,10 +93,14 @@
/* 获取资讯列表数据 */
getNewsList() {
if (this.scrollDisabled) {
return;
}
this.scrollDisabled = true;
$.get({
url: '/editorial/list.json',
data: {
page: this.page++,
page: this.page,
channel: this.channel
}
}).done(result => {
... ... @@ -105,15 +109,14 @@
this.$set('editorialList', this.editorialList.concat(result.data.list));
} else if (result.data.list.length > 0) {
this.editorialList = result.data.list;
} else {
this.scrollDisabled = true;
}
this.page++;
this.scrollDisabled = false;
} else {
this.scrollDisabled = true;
tip('没有了...');
}
}).fail(() => {
tip('服务器错误');
this.scrollDisabled = false;
});
},
... ...