景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1014 B

8 months ago
  1. function query(self, queryParams){
  2. return (self.beforeGetData && self.beforeGetData()) ||
  3. queryParams || self.queryParams
  4. }
  5. export default {
  6. data() {
  7. return {
  8. queryParams: {
  9. pageNo: 1,
  10. pageSize: 10,
  11. },
  12. total : 0,
  13. list : [],
  14. }
  15. },
  16. onReachBottom() {
  17. this.loadMoreData()
  18. },
  19. methods: {
  20. getData(queryParams){
  21. return new Promise((success, error) => {
  22. if(!this.mixinsListApi){
  23. return console.error('mixinsListApi 缺失');
  24. }
  25. this.$api(this.mixinsListApi,
  26. query(this, queryParams), res => {
  27. uni.stopPullDownRefresh()
  28. if(res.code == 200){
  29. this[this.mixinsListKey || 'list'] = res.result.records
  30. this.total = res.result.total
  31. success(res.result)
  32. this.getDataThen && this.getDataThen()
  33. }
  34. })
  35. })
  36. },
  37. loadMoreData(){
  38. console.log('loadMoreData----', this.queryParams.pageSize < this.total);
  39. if(this.queryParams.pageSize < this.total){
  40. this.queryParams.pageSize += 10
  41. this.getData()
  42. }
  43. },
  44. }
  45. }