|
| 1 | +<script setup> |
| 2 | +import { onMounted, ref } from 'vue' |
| 3 | +import { useColorModes } from '@coreui/vue' |
| 4 | +import AppBreadcrumb from './AppBreadcrumb' |
| 5 | +import AppHeaderDropdownAccnt from './AppHeaderDropdownAccnt' |
| 6 | +
|
| 7 | +const headerClassNames = ref('mb-4 p-0') |
| 8 | +const { colorMode, setColorMode } = useColorModes('coreui-free-vue-admin-template-theme') |
| 9 | +
|
| 10 | +onMounted(() => { |
| 11 | + document.addEventListener('scroll', () => { |
| 12 | + if (document.documentElement.scrollTop > 0) { |
| 13 | + headerClassNames.value = 'mb-4 p-0 shadow-sm' |
| 14 | + } else { |
| 15 | + headerClassNames.value = 'mb-4 p-0' |
| 16 | + } |
| 17 | + }) |
| 18 | +}) |
| 19 | +</script> |
| 20 | + |
1 | 21 | <template> |
2 | 22 | <CHeader position="sticky" :class="headerClassNames"> |
3 | 23 | <CContainer class="border-bottom px-4" fluid> |
|
83 | 103 | </CContainer> |
84 | 104 | </CHeader> |
85 | 105 | </template> |
86 | | - |
87 | | -<script> |
88 | | -import { onMounted, ref } from 'vue' |
89 | | -import { useColorModes } from '@coreui/vue' |
90 | | -import AppBreadcrumb from './AppBreadcrumb' |
91 | | -import AppHeaderDropdownAccnt from './AppHeaderDropdownAccnt' |
92 | | -export default { |
93 | | - name: 'AppHeader', |
94 | | - components: { |
95 | | - AppBreadcrumb, |
96 | | - AppHeaderDropdownAccnt, |
97 | | - }, |
98 | | - setup() { |
99 | | - const headerClassNames = ref('mb-4 p-0') |
100 | | - const { colorMode, setColorMode } = useColorModes('coreui-free-vue-admin-template-theme') |
101 | | -
|
102 | | - onMounted(() => { |
103 | | - document.addEventListener('scroll', () => { |
104 | | - if (document.documentElement.scrollTop > 0) { |
105 | | - headerClassNames.value = 'mb-4 p-0 shadow-sm' |
106 | | - } else { |
107 | | - headerClassNames.value = 'mb-4 p-0' |
108 | | - } |
109 | | - }) |
110 | | - }) |
111 | | -
|
112 | | - return { |
113 | | - headerClassNames, |
114 | | - colorMode, |
115 | | - setColorMode, |
116 | | - } |
117 | | - }, |
118 | | -} |
119 | | -</script> |
0 commit comments