123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <template>
- <div :class="[idDrawerTabs?'dtc-main':'']" :style="myStyle">
- <div :class="[idDrawerTabs?'dtc-body':'']">
- <slot/>
- </div>
- </div>
- </template>
- <style lang="scss" scoped>
- .dtc-main {
- display: flex;
- flex-direction: column;
- width: 100%;
- overflow: hidden;
- position: relative;
- transform: translateZ(0);
- .dtc-body {
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- overflow: auto;
- }
- }
- </style>
- <script>
- export default {
- name: 'DrawerTabsContainer',
- data() {
- return {
- idDrawerTabs: false,
- calculateHeight: 0,
- }
- },
- mounted() {
- let el = $A(this.$el);
- let eb = el.parents(".ivu-drawer-body");
- if (eb == 0 || eb.parents(".ivu-drawer-wrap").length == 0) {
- return;
- }
- this.idDrawerTabs = true;
- this.calculateHeight = Math.round(eb.outerHeight() - el.offset().top);
- setInterval(() => {
- this.calculateHeight = Math.round(eb.outerHeight() - el.offset().top);
- }, 300);
- },
- computed: {
- myStyle() {
- const {calculateHeight, idDrawerTabs} = this;
- if (!idDrawerTabs) {
- return {};
- }
- return {
- height: Math.max(0, calculateHeight - 16) + 'px'
- }
- }
- },
- }
- </script>
|