-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
75 lines (71 loc) · 1.87 KB
/
app.vue
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
<div>
<Header :dark-bg="darkBg" />
<NuxtPage />
</div>
</template>
<script lang="ts" setup>
import isElementBgDark from '@/composables/isElementBgDark'
import isBehindElement from '@/composables/isBehindElement'
useHead({
title: 'Nodalit – web-apps til mennesker',
meta: [
{
hid: 'description',
name: 'description',
content: 'Vi laver digitale løsninger for vores kunder – store som små. Vi har fair priser og vi elsker vores arbejde.',
},
{
hid: 'sharetitle',
name: 'og:title',
content: 'Nodalit – web-apps til mennesker',
},
{
hid: 'sharedescription',
name: 'og:description',
content: 'Vi laver digitale løsninger for vores kunder – store som små. Vi har fair priser og vi elsker vores arbejde.',
},
{
hid: 'sharetype',
name: 'og:type',
content: 'website',
},
{
hid: 'shareurl',
name: 'og:url',
content: 'https://www.nodalit.com',
},
{
hid: 'shareimage',
property: 'og:image',
content: 'https://www.nodalit.com/shareimage_logo_nobg.png',
},
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.png' },
],
})
const darkBg = ref(true)
const scrolling = () => {
const htmlCollection = document.getElementsByClassName('base-section')
const baseSectionEls = Array.from(htmlCollection)
const headerEl = document.getElementById('header')
if (headerEl && Array.isArray(baseSectionEls)) {
baseSectionEls.forEach((element) => {
if (isBehindElement(headerEl, element)) {
const isDark = isElementBgDark(element)
if (isDark !== darkBg.value) {
darkBg.value = isDark
}
}
})
}
}
onMounted(() => {
scrolling()
window.addEventListener('scroll', scrolling)
})
onUnmounted(() => {
window.removeEventListener('scroll', scrolling)
})
</script>