index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {
  2. getHeight
  3. } from "../../utils/GetRheRemainingHeight";
  4. Component({
  5. properties: {
  6. height: {
  7. type: Number
  8. }, //组件高度
  9. getlist: {
  10. type: Function
  11. },
  12. pullDown: { //是否开启下拉
  13. type: Boolean,
  14. value: true
  15. },
  16. safety: { //适配苹果底部安全距离
  17. type: Boolean,
  18. value: true
  19. },
  20. },
  21. data: {
  22. inRefresh: false, //下拉开启自定义项
  23. },
  24. methods: {
  25. /* 下拉刷新 */
  26. pullToRefresh() {
  27. this.setData({
  28. inRefresh: true
  29. })
  30. this.triggerEvent("getlist", true)
  31. },
  32. /* 刷新完成 */
  33. RefreshToComplete() {
  34. setTimeout(() => {
  35. this.setData({
  36. inRefresh: false
  37. })
  38. }, 500)
  39. },
  40. /* 加载分页 */
  41. loadThePage() {
  42. this.triggerEvent("getlist", false)
  43. },
  44. /* 设置组件高度 */
  45. setHeight(element, that) {
  46. getHeight(element, that).then(res => {
  47. if (this.data.height != res) this.setData({
  48. height: res
  49. })
  50. });
  51. }
  52. }
  53. })