-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
77 lines (72 loc) · 1.89 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
76
77
<style lang="scss">
@import './styles/application';
</style>
<template>
<div id="app">
<metainfo>
<template v-slot:title="{ content }">{{ content }} | Atlas of Oregon Lakes</template>
</metainfo>
<nav-bar v-bind:class="[!isOnline() ? 'offline' : '']"/>
<offline-bar v-if="!isOnline()"/>
<not-found v-else-if="resourceNotFound()"/>
<error-bar v-else-if="hasError()" :error="error"/>
<router-view />
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex';
import OfflineBar from '@/components/OfflineBar';
import NavBar from '@/components/NavBar';
import ErrorBar from '@/components/ErrorBar';
import NotFound from '@/components/NotFound';
export default {
name: 'app',
head () {
return {
htmlAttrs: {'lang': 'en-US'},
meta: [
{name: "description",
content: "The Atlas of Oregon Lakes is a resource for the public, resource management agencies, and scientists to enhance management and enjoyment of our lakes. The online atlas is an updated version of the popular Atlas of Oregon Lakes published in 1985."},
{name: "viewport",
content: "width=device-width,initial-scale=1.0,user-scalable=no"}
]
}
},
components: {
NavBar,
OfflineBar,
ErrorBar,
NotFound
},
computed: {
...mapGetters({notFound: 'getNotFound',
error: 'getError'}),
},
methods: {
...mapActions(['fetchPage']),
isOnline () {
return navigator.onLine;
},
resourceNotFound () {
return this.notFound;
},
hasError () {
return this.error != null;
}
},
created () {
// pre-fetch major flatpages
['bathymetry',
'aquatic-invasives',
'about',
'photo-submissions'].forEach((slug) => {
this.fetchPage({slug:slug, store:false});
});
}
}
</script>
<style lang="scss" scoped>
#app {
overflow: hidden;
}
</style>