index.vue
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script setup lang="ts">
import NodeFilter from './NodeFilter.vue';
import CategoryPanel from './CategoryPanel.vue';
import { computed, CSSProperties, ref, unref } from 'vue';
import { Icon } from '/@/components/Icon';
import { Tooltip } from 'ant-design-vue';
const expand = ref(true);
const searchText = ref();
const handleOnFold = () => {
expand.value = false;
};
const getSidebarStyle = computed<CSSProperties>(() => {
return {
flex: `0 0 ${unref(expand) ? '320px' : 0}`,
width: unref(expand) ? '320px' : 0,
minWidth: unref(expand) ? '320px' : 0,
};
});
const handleSearch = (value: string) => {
searchText.value = value;
};
</script>
<template>
<section
:style="getSidebarStyle"
class="h-full shadow shadow-lg relative z-50 shadow-dark-600 overflow-hidden transition-all"
>
<NodeFilter @fold="handleOnFold" @search="handleSearch" />
<CategoryPanel :searchText="searchText" />
</section>
<Tooltip title="展开">
<Icon
icon="ant-design:menu-unfold-outlined"
class="cursor-pointer svg:text-2xl absolute top-5 left-5 z-40 !flex justify-center items-center w-10 h-10 rounded-1 bg-blue-200 svg:text-light-50 shadow-lg"
@click="expand = true"
/>
</Tooltip>
</template>