DrawerTabsContainer.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="dtc-main" :style="myStyle">
  3. <div class="dtc-body">
  4. <slot/>
  5. </div>
  6. </div>
  7. </template>
  8. <style lang="scss" scoped>
  9. .dtc-main {
  10. display: flex;
  11. flex-direction: column;
  12. width: 100%;
  13. overflow: hidden;
  14. position: relative;
  15. transform: rotateZ(0);
  16. .dtc-body {
  17. position: absolute;
  18. left: 0;
  19. right: 0;
  20. top: 0;
  21. bottom: 0;
  22. width: 100%;
  23. height: 100%;
  24. overflow: auto;
  25. }
  26. }
  27. </style>
  28. <script>
  29. export default {
  30. name: 'DrawerTabsContainer',
  31. data() {
  32. return {
  33. calculateHeight: 0,
  34. }
  35. },
  36. mounted() {
  37. let el = $A(this.$el);
  38. let eb = el.parents(".ivu-drawer-body");
  39. this.calculateHeight = eb.outerHeight() - el.offset().top;
  40. setInterval(() => {
  41. this.calculateHeight = eb.outerHeight() - el.offset().top;
  42. }, 1000);
  43. },
  44. computed: {
  45. myStyle() {
  46. const {calculateHeight} = this;
  47. return {
  48. height: Math.max(0, calculateHeight - 16) + 'px'
  49. }
  50. }
  51. },
  52. }
  53. </script>