-
Notifications
You must be signed in to change notification settings - Fork 185
/
App.vue
executable file
·86 lines (81 loc) · 1.79 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
78
79
80
81
82
83
84
85
<template>
<div id="app">
<i class="fa fa-refresh fa-spin fa-1x fa-fw text-yellow loading-icon" v-show="pagestate.loading"></i>
<router-view></router-view>
<transition
name="custom-classes-transition"
enter-active-class="animated fadeIn"
leave-active-class="animated fadeOut"
>
<p class="pagetop" v-if="showReturnToTop">
<a v-on:click="returnToTop()"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
</p>
</transition>
</div>
</template>
<script>
/* global $ */
import { mapState } from 'vuex'
import { Notification } from 'uiv'
import 'animate.css/animate.min.css'
import './css/returnToTop.css'
export default {
name: 'App',
computed: {
...mapState([
'pagestate'
]),
currentAlerts () { return this.$store.state.pagestate.alerts }
},
watch: {
// use the watch to react on the value change.
currentAlerts (alerts) {
alerts.forEach(element => {
if (element.notify) {
Notification.notify({
type: element.type,
title: element.title,
content: element.content
})
element.notify = false
}
})
}
},
data () {
return {
section: 'Head',
showReturnToTop: false
}
},
methods: {
returnToTop () {
$('body, html').animate({
scrollTop: 0
}, 500)
return false
}
},
mounted () {
// 画面表示時に読み込み
this.$nextTick(() => {
// トップへ戻る
$(window).scroll(() => {
if ($(window).scrollTop() > 130) {
this.showReturnToTop = true
} else {
this.showReturnToTop = false
}
})
})
}
}
</script>
<style>
.loading-icon {
position: fixed;
bottom: 0px;
left: 0px;
z-index: 9998;
}
</style>