🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```js data() { return { movieList: [], loading: false, finished: false, total: '', count: 0, } }, created() { }, methods: { handleData(res) { var subjects = res.subjects; var movies = []; subjects.forEach(item => { var temp = { id: item.id, image: item.images.small, title: item.title }; movies.push(temp); }); this.total = res.total; this.movieList = [...this.movieList, ...movies]; }, onLoad() { // 给个定时器,防止不断执行 setTimeout(() => { // 加载状态结束 var length = this.movieList.length; var url = `http://douban.uieee.com/v2/movie/coming_soon?start=${length}&count=20`; axios.jsonp(url).then(res => { this.handleData(res); this.loading = false; // 数据全部加载完成 if (length >= this.total) { this.finished = true; } }); }, 500); } },