| | |
| | | }, |
| | | data() { |
| | | return { |
| | | typeId: "", |
| | | data: [], |
| | | loading: false, |
| | | busy: false, |
| | |
| | | current: 1, |
| | | }; |
| | | }, |
| | | watch: { |
| | | '$route'(to, from) { |
| | | if ("articleList" === to.name) { |
| | | this.typeId = this.$route.query.typeId; |
| | | } |
| | | }, |
| | | typeId: function(newValue, oldValue) { |
| | | this.busy = true; |
| | | this.$message.info('loading',0.3); |
| | | this.onChange(1); |
| | | } |
| | | |
| | | }, |
| | | activated() { |
| | | window.addEventListener('scroll', this); |
| | | }, |
| | | deactivated() { |
| | | window.removeEventListener('scroll', this); |
| | | }, |
| | | beforeMount() { |
| | | queryBlogArticleList({ |
| | | pageNo: this.current |
| | | pageNo: this.current, |
| | | typeId: this.typeId |
| | | }).then((res) => { |
| | | this.total = Number(res.data.total) |
| | | this.pageSize = Number(res.data.size); |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | |
| | | onChange(current) { |
| | | this.current = current; |
| | | queryBlogArticleList({ |
| | | pageNo: this.current |
| | | pageNo: current, |
| | | typeId: this.typeId |
| | | }).then((res) => { |
| | | this.busy = false; |
| | | this.total = Number(res.data.total) |
| | |
| | | loadMore() { |
| | | this.loading = true; |
| | | this.busy = true; |
| | | |
| | | |
| | | queryBlogArticleList({ |
| | | pageNo: this.current + 1 |
| | | pageNo: this.current + 1, |
| | | typeId: this.typeId |
| | | }).then((res) => { |
| | | |
| | | this.total = Number(res.data.total) |
| | |
| | | this.data = this.data.concat(res.data.records); |
| | | this.busy = false; |
| | | if (res.data.records.length == 0) { |
| | | this.$message.warning('别滑了,别滑了,到底了..'); |
| | | //this.$message.warning('别滑了,别滑了,到底了..'); |
| | | this.busy = true; |
| | | this.loading = false; |
| | | return; |