-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathStaticPage.vue
88 lines (80 loc) · 1.82 KB
/
StaticPage.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
78
79
80
81
82
83
84
85
86
87
88
<template>
<div>
<vue-markdown :source="content" class="static-page-content" @rendered="onRendered" />
<b-modal
ref="mapDialog"
title="Карта сейсмических станций"
:no-close-on-backdrop="true"
:hide-footer="true"
:lazy="true"
size="lg"
@shown="onMapDialogOpen">
<MainMageMap ref="map" :onlyStations="true" :gestureHandling="false" />
</b-modal>
</div>
</template>
<script>
import VueMarkdown from 'vue-markdown'
import MainMageMap from '@/components/maps/Mainpage'
export default {
name: 'static-page',
components: { VueMarkdown, MainMageMap },
data() {
return {
content: '',
page: this.$router.currentRoute.params.page,
pages: {
about: 'О проекте'
}
}
},
metaInfo() {
return {
title: this.pages[this.page]
}
},
methods: {
getContent() {
this.$http.get(`/static/markdown/${this.page}.md`).then(response => {
this.content = response.data
})
},
onRendered() {
!this.$el || setTimeout(() => {
this.$el.querySelector('.mainpage-map-link').addEventListener('click', e => {
e.preventDefault()
this.$refs.mapDialog.show()
})
})
},
onMapDialogOpen() {
this.$refs.map.map.object.invalidateSize()
}
},
created() {
this.getContent()
},
beforeRouteUpdate(to, from, next) {
this.page = to.params.page
this.getContent()
next()
}
}
</script>
<style lang="scss" scoped>
@import '~scss/_variables';
@import '~scss/_mixins';
@import '~scss/_modal_map.scss';
.static-page-content /deep/
{
margin-top: 3%;
h1, h2, h3, h4, h5, h6 {
text-align: center !important;
}
img {
display: block;
margin: 0 auto;
max-width: 100%;
}
}
</style>