report-health-scheme.ts 688 B

12345678910111213141516171819202122232425262728
  1. // module/health/components/report-health-scheme/report-health-scheme.ts
  2. Component({
  3. lifetimes: {},
  4. properties: {
  5. dataset: { type: Object },
  6. },
  7. data: {
  8. wrapper: { width: 'auto', height: 'auto' },
  9. show: false,
  10. },
  11. observers: {
  12. 'dataset'(data) {
  13. const show = !!data;
  14. this.setData({ show })
  15. if (show) setTimeout(() => this._getContainerRect(), 300);
  16. }
  17. },
  18. methods: {
  19. _getContainerRect() {
  20. this.createSelectorQuery().select('.wrapper__bg').boundingClientRect().exec(res => {
  21. this.setData({
  22. 'wrapper.width': `${res[0]?.width}px`,
  23. 'wrapper.height': `${res[0]?.height}px`,
  24. })
  25. })
  26. }
  27. }
  28. })