|
1 | 1 | <template> |
2 | | - <div class="relative grow flex items-stretch min-h-0"> |
3 | | - <NanoLeftActionBar v-if="!ctl.hideLeftActionBar"/> |
4 | | - <NanoLeftSidebar v-if="!ctl.hideLeftSidebar"/> |
5 | | - <NanoMain/> |
6 | | - <NanoRightSidebar v-if="!ctl.hideRightSidebar"/> |
7 | | - <NanoRightActionBar v-if="!ctl.hideRightActionBar"/> |
| 2 | + <div ref="body" class="relative grow flex items-stretch min-h-0"> |
| 3 | + <NanoLeftActionBar v-if="!ctl.hideLeftActionBar" ref="leftActionBar"/> |
| 4 | + <NanoLeftSidebar v-if="!ctl.hideLeftSidebar" ref="leftSidebar"> |
| 5 | + <!--draggable line--> |
| 6 | + <div |
| 7 | + ref="leftDraggableLine" |
| 8 | + class="absolute z-2 right--1 top-0 h-full w-1 bg-transparent cursor-col-resize" |
| 9 | + /> |
| 10 | + </NanoLeftSidebar> |
| 11 | + <NanoMain ref="main"/> |
| 12 | + <NanoRightSidebar v-if="!ctl.hideRightSidebar" ref="rightSidebar"> |
| 13 | + <!--draggable line--> |
| 14 | + <div |
| 15 | + ref="rightDraggableLine" |
| 16 | + class="absolute z-2 left--1 top-0 h-full w-1 bg-transparent cursor-col-resize" |
| 17 | + /> |
| 18 | + </NanoRightSidebar> |
| 19 | + <NanoRightActionBar v-if="!ctl.hideRightActionBar" ref="rightActionBar"/> |
8 | 20 | </div> |
9 | 21 | </template> |
10 | 22 |
|
|
15 | 27 | import NanoLeftActionBar from '@NanoUI/NanoLeftActionBar/index.vue'; |
16 | 28 | import NanoRightActionBar from '@NanoUI/NanoRightActionBar/index.vue'; |
17 | 29 | import { controllerStore } from '@store/controller'; |
| 30 | + import { onMounted, ref } from 'vue'; |
| 31 | + import { dragChangeWidth } from '../../utils/dragChangeWidth'; |
| 32 | +
|
18 | 33 | const ctl = controllerStore(); |
| 34 | +
|
| 35 | + const body = ref<HTMLElement | null>(null); |
| 36 | + const leftActionBar = ref<InstanceType<typeof NanoLeftActionBar> | null>(); |
| 37 | + const leftSidebar = ref<InstanceType<typeof NanoLeftSidebar> | null>(); |
| 38 | + const rightSidebar = ref<InstanceType<typeof NanoRightSidebar> | null>(); |
| 39 | + const rightActionBar = ref<InstanceType<typeof NanoRightActionBar> | null>(); |
| 40 | +
|
| 41 | + const leftDraggableLine = ref<HTMLDivElement | null>(); |
| 42 | + const rightDraggableLine = ref<HTMLDivElement | null>(); |
| 43 | +
|
| 44 | + onMounted(() => { |
| 45 | + dragChangeWidth({ |
| 46 | + parentEl: body.value!, |
| 47 | + targetEl: leftSidebar.value!.$el, |
| 48 | + dragEl: leftDraggableLine.value!, |
| 49 | + otherEls: [ rightSidebar.value!.$el, leftActionBar.value!.$el, rightActionBar.value!.$el ] |
| 50 | + }); |
| 51 | + dragChangeWidth({ |
| 52 | + parentEl: body.value!, |
| 53 | + targetEl: rightSidebar.value!.$el, |
| 54 | + dragEl: rightDraggableLine.value!, |
| 55 | + otherEls: [ leftSidebar.value!.$el, leftActionBar.value!.$el, rightActionBar.value!.$el ], |
| 56 | + reverseDirection: true |
| 57 | + }); |
| 58 | + }); |
19 | 59 | </script> |
20 | 60 |
|
21 | 61 | <style scoped lang="scss"> |
|
0 commit comments