-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
70 lines (65 loc) · 2.04 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
<template>
<NuxtLayout :name="default">
<NuxtPage />
</NuxtLayout>
</template>
<script>
export default {
name: 'App',
head() {
return {
title: 'Wellington N. Portfolio',
link: [
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/icon?family=Material+Icons' },
{ rel: 'icon', type: 'image/png', href: '/favicons/favicon-96x96.png', sizes: '96x96' },
{ rel: 'icon', type: 'image/svg+xml', href: '/favicons/favicon.svg' },
{ rel: 'shortcut icon', href: '/favicons/favicon.ico' },
{ rel: 'apple-touch-icon', sizes: '180x180', href: '/favicons/apple-touch-icon.png' },
{ rel: 'manifest', href: '/favicons/site.webmanifest' }
],
meta: [
{ name: 'apple-mobile-web-app-title', content: 'Wellington N. Portfolio' }
],
script: [
{ src: '/js/vanilla-tilt.min.js' },
]
}
},
beforeMount() {
// Importe o head aqui
const head = this.$options.head.call(this)
document.title = head.title
head.link.forEach(link => {
const linkElement = document.createElement('link')
Object.keys(link).forEach(key => {
linkElement.setAttribute(key, link[key])
})
document.head.appendChild(linkElement)
});
head.meta.forEach(meta => {
const metaElement = document.createElement('meta')
Object.keys(meta).forEach(key => {
metaElement.setAttribute(key, meta[key])
})
document.head.appendChild(metaElement)
});
head.script.forEach(script => {
const scriptElement = document.createElement('script')
Object.keys(script).forEach(key => {
scriptElement.setAttribute(key, script[key])
})
document.head.appendChild(scriptElement)
});
if (localStorage.getItem('lang')) {
try {
this.$i18n.locale = localStorage.getItem('lang')
} catch (e) {
localStorage.removeItem('lang');
}
} else {
localStorage.setItem('lang', this.$i18n.locale)
this.$i18n.locale = localStorage.getItem('lang')
}
}
}
</script>