-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
139 lines (118 loc) · 4.78 KB
/
App.js
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import Vue from 'vue'
import NuxtLoading from './components/nuxt-loading.vue'
import NuxtBuildIndicator from './components/nuxt-build-indicator'
import '../node_modules/buefy/dist/buefy.css'
import '../assets/CSS/main.css'
import '../assets/CSS/animation.css'
import '../node_modules/bulma-extensions/dist/css/bulma-extensions.min.css'
import '../assets/CSS/style.scss'
import '../assets/CSS/customanimation.scss'
import '../assets/CSS/custom.scss'
import '../assets/CSS/quate.css'
import '../node_modules/@fortawesome/fontawesome-free/css/all.min.css'
import '../node_modules/bulma/css/bulma.css'
import _6f6c098b from '../layouts/default.vue'
const layouts = { "_default": _6f6c098b }
export default {
head: {"title":"shrishportfolio","meta":[{"charset":"utf-8"},{"name":"viewport","content":"width=device-width, initial-scale=1"},{"hid":"description","name":"description","content":"My stunning Nuxt.js project"},{"hid":"mobile-web-app-capable","name":"mobile-web-app-capable","content":"yes"},{"hid":"apple-mobile-web-app-title","name":"apple-mobile-web-app-title","content":"shrishportfolio"},{"hid":"author","name":"author","content":"Shrish Ankit"},{"hid":"theme-color","name":"theme-color","content":"#fff"},{"hid":"og:type","name":"og:type","property":"og:type","content":"website"},{"hid":"og:title","name":"og:title","property":"og:title","content":"shrishportfolio"},{"hid":"og:site_name","name":"og:site_name","property":"og:site_name","content":"shrishportfolio"},{"hid":"og:description","name":"og:description","property":"og:description","content":"My stunning Nuxt.js project"}],"link":[{"rel":"icon","type":"image\u002Fx-icon","href":"\u002Ffavicon.ico"},{"rel":"manifest","href":"\u002F_nuxt\u002Fmanifest.07c08212.json"},{"rel":"shortcut icon","href":"\u002F_nuxt\u002Ficons\u002Ficon_64.9mld2VBMsQ$.png"},{"rel":"apple-touch-icon","href":"\u002F_nuxt\u002Ficons\u002Ficon_512.9mld2VBMsQ$.png","sizes":"512x512"},{"rel":"stylesheet","type":"text\u002Fcss","href":"\u002F\u002Fcdn.materialdesignicons.com\u002F2.4.85\u002Fcss\u002Fmaterialdesignicons.min.css"}],"style":[],"script":[],"htmlAttrs":{"lang":"en"}},
render(h, props) {
const loadingEl = h('NuxtLoading', { ref: 'loading' })
const layoutEl = h(this.layout || 'nuxt')
const templateEl = h('div', {
domProps: {
id: '__layout'
},
key: this.layoutName
}, [ layoutEl ])
const transitionEl = h('transition', {
props: {
name: 'layout',
mode: 'out-in'
},
on: {
beforeEnter(el) {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
}
}
}, [ templateEl ])
return h('div', {
domProps: {
id: '__nuxt'
}
}, [loadingEl, h(NuxtBuildIndicator), transitionEl])
},
data: () => ({
isOnline: true,
layout: null,
layoutName: ''
}),
beforeCreate() {
Vue.util.defineReactive(this, 'nuxt', this.$options.nuxt)
},
created() {
// Add this.$nuxt in child instances
Vue.prototype.$nuxt = this
// add to window so we can listen when ready
if (process.client) {
window.$nuxt = this
this.refreshOnlineStatus()
// Setup the listeners
window.addEventListener('online', this.refreshOnlineStatus)
window.addEventListener('offline', this.refreshOnlineStatus)
}
// Add $nuxt.error()
this.error = this.nuxt.error
},
mounted() {
this.$loading = this.$refs.loading
},
watch: {
'nuxt.err': 'errorChanged'
},
computed: {
isOffline() {
return !this.isOnline
}
},
methods: {
refreshOnlineStatus() {
if (process.client) {
if (typeof window.navigator.onLine === 'undefined') {
// If the browser doesn't support connection status reports
// assume that we are online because most apps' only react
// when they now that the connection has been interrupted
this.isOnline = true
} else {
this.isOnline = window.navigator.onLine
}
}
},
errorChanged() {
if (this.nuxt.err && this.$loading) {
if (this.$loading.fail) this.$loading.fail()
if (this.$loading.finish) this.$loading.finish()
}
},
setLayout(layout) {
if(layout && typeof layout !== 'string') throw new Error('[nuxt] Avoid using non-string value as layout property.')
if (!layout || !layouts['_' + layout]) {
layout = 'default'
}
this.layoutName = layout
this.layout = layouts['_' + layout]
return this.layout
},
loadLayout(layout) {
if (!layout || !layouts['_' + layout]) {
layout = 'default'
}
return Promise.resolve(layouts['_' + layout])
}
},
components: {
NuxtLoading
}
}