VueJS无限滚动重复数组的相同数据

时间:2019-07-08 11:04:30

标签: vue.js infinite-scroll

我在这里遇到无限滚动的问题。问题是,当我不断滚动时,它会重复相同的数据。我希望它在显示数组的所有数据时不再显示更多数据。有什么办法解决这个问题?这是我的功能:

    loadMore: function() {
        this.busy = true;
        const payload = {
            id: this.$route.params.threadID
        }
        setTimeout(() => {
            this.$store.dispatch('getForumThread', payload).then(data => {
                data.replies.forEach(element => {
                    this.replies.push(element);
                });          
            });
            console.log(this.data)
            this.busy = false;
        }, 1000);
    }   

0 个答案:

没有答案