index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Component({
  2. externalClasses: ['l-class','l-loading-class','l-end-class','l-line-class'],
  3. options: {
  4. multipleSlots: true // 在组件定义时的选项中启用多slot支持
  5. },
  6. properties: {
  7. show: Boolean,
  8. custom: Boolean,
  9. line: Boolean,
  10. color: String,
  11. size: {
  12. type: String,
  13. value: '28'
  14. },
  15. type: {
  16. type: String,
  17. value: 'loading'
  18. },
  19. endText: {
  20. type: String,
  21. value: '我是有底线的~'
  22. },
  23. loadingText: {
  24. type: String,
  25. value: '加载中...'
  26. }
  27. },
  28. data: {
  29. },
  30. attached() {
  31. this._init();
  32. },
  33. pageLifetimes: {
  34. show() {
  35. this._init();
  36. },
  37. },
  38. methods: {
  39. _init() {
  40. wx.lin = wx.lin || {};
  41. wx.lin.showLoadmore = (options) => {
  42. const {
  43. custom = false,
  44. line = false,
  45. color = '',
  46. size = '28',
  47. type = 'loading',
  48. endText = '我是有底线的',
  49. loadingText = '加载中...'
  50. } = { ...options };
  51. this.setData({
  52. custom,
  53. line,
  54. color,
  55. size,
  56. type,
  57. endText,
  58. loadingText,
  59. show: true
  60. });
  61. };
  62. wx.lin.hideLoadmore = () => {
  63. this.setData({
  64. show: false
  65. });
  66. };
  67. },
  68. onLoadmore() {
  69. this.triggerEvent('lintap', {}, {
  70. bubbles: true,
  71. composed: true
  72. });
  73. }
  74. }
  75. });