index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import computeOffset from '../behaviors/computeOffset';
  2. Component({
  3. behaviors: [computeOffset],
  4. externalClasses: ['l-container-class', 'l-class'],
  5. options: {
  6. multipleSlots: true
  7. },
  8. properties: {
  9. // 显示与隐藏
  10. show: {
  11. type: Boolean,
  12. value: false
  13. },
  14. opacity:{
  15. type: String,
  16. value: '1'
  17. },
  18. bgColor: {
  19. type: String,
  20. value: '#fff'
  21. },
  22. zIndex:{
  23. type: Number,
  24. value: 776
  25. },
  26. // 类型
  27. type: {
  28. type: String,
  29. value: 'rotate'
  30. },
  31. // 动画颜色
  32. color: {
  33. type: String,
  34. value: ''
  35. },
  36. // loading 动画大小
  37. size: {
  38. type: String,
  39. value: 'medium',
  40. },
  41. // 自定义
  42. custom: Boolean,
  43. // 全屏模式
  44. fullScreen: Boolean
  45. },
  46. attached() {
  47. this._init();
  48. },
  49. pageLifetimes: {
  50. show() {
  51. this._init();
  52. },
  53. },
  54. methods: {
  55. _init() {
  56. wx.lin = wx.lin || {};
  57. wx.lin.showLoading = (options) => {
  58. const {
  59. custom = false,
  60. fullScreen = false,
  61. color = '',
  62. type = 'rotate',
  63. size = 'medium',
  64. opacity = '1'
  65. } = { ...options };
  66. this.setData({
  67. custom,
  68. fullScreen,
  69. color,
  70. type,
  71. size,
  72. opacity,
  73. show: true
  74. });
  75. };
  76. wx.lin.hideLoading = () => {
  77. this.setData({
  78. show: false
  79. });
  80. };
  81. },
  82. // 阻止滑动
  83. doNothingMove() {
  84. // do nothing……
  85. },
  86. }
  87. });