report-health-status.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // module/health/components/report-health-status/report-health-status.ts
  2. function getDraggableSheetContext(this: any) {
  3. return this as { scroll: WechatMiniprogram.DraggableSheetContext }
  4. }
  5. const { windowHeight } = wx.getSystemInfoSync()
  6. const menuRect = wx.getMenuButtonBoundingClientRect()
  7. const menuBottom = menuRect.bottom + 1
  8. Component({
  9. options: {
  10. multipleSlots: true,
  11. },
  12. properties: {
  13. dataset: { type: Object },
  14. loading: { type: Boolean, value: false },
  15. message: { type: String, value: '' },
  16. },
  17. data: {
  18. sheetHeight: windowHeight - menuBottom,
  19. initialSize: 0,
  20. minSize: 0,
  21. maxSize: 1,
  22. },
  23. lifetimes: {
  24. created() {
  25. this.createSelectorQuery().select('.draggable-sheet-wrapper').node().exec(res => {
  26. getDraggableSheetContext.call(this).scroll = res[0].node;
  27. })
  28. }
  29. },
  30. methods: {
  31. showList() {
  32. console.log('showList', this);
  33. getDraggableSheetContext.call(this).scroll.scrollTo({
  34. size: 0.5,
  35. pixels: 600,
  36. animated: true,
  37. duration: 300,
  38. easingFunction: 'ease'
  39. })
  40. },
  41. toInfoPage() {
  42. this.triggerEvent('info')
  43. }
  44. }
  45. })