Skip to content

Commit 68d8d50

Browse files
initial commit
0 parents  commit 68d8d50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+28033
-0
lines changed

.DS_Store

8 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.idea/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/devriz-website.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.nuxt/App.js

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
import Vue from 'vue'
2+
import { decode, parsePath, withoutBase, withoutTrailingSlash, normalizeURL } from 'ufo'
3+
4+
import { getMatchedComponentsInstances, getChildrenComponentInstancesUsingFetch, promisify, globalHandleError, urlJoin, sanitizeComponent } from './utils'
5+
import NuxtError from '..\\layouts\\error.vue'
6+
import NuxtLoading from './components/nuxt-loading.vue'
7+
import NuxtBuildIndicator from './components/nuxt-build-indicator'
8+
9+
import '..\\assets\\css\\tailwind.css'
10+
11+
import _6f6c098b from './layouts/default.vue'
12+
13+
const layouts = { "_default": sanitizeComponent(_6f6c098b) }
14+
15+
export default {
16+
render (h, props) {
17+
const loadingEl = h('NuxtLoading', { ref: 'loading' })
18+
19+
const layoutEl = h(this.layout || 'nuxt')
20+
const templateEl = h('div', {
21+
domProps: {
22+
id: '__layout'
23+
},
24+
key: this.layoutName
25+
}, [layoutEl])
26+
27+
const transitionEl = h('transition', {
28+
props: {
29+
name: 'layout',
30+
mode: 'out-in'
31+
},
32+
on: {
33+
beforeEnter (el) {
34+
// Ensure to trigger scroll event after calling scrollBehavior
35+
window.$nuxt.$nextTick(() => {
36+
window.$nuxt.$emit('triggerScroll')
37+
})
38+
}
39+
}
40+
}, [templateEl])
41+
42+
return h('div', {
43+
domProps: {
44+
id: '__nuxt'
45+
}
46+
}, [
47+
loadingEl,
48+
h(NuxtBuildIndicator),
49+
transitionEl
50+
])
51+
},
52+
53+
data: () => ({
54+
isOnline: true,
55+
56+
layout: null,
57+
layoutName: '',
58+
59+
nbFetching: 0
60+
}),
61+
62+
beforeCreate () {
63+
Vue.util.defineReactive(this, 'nuxt', this.$options.nuxt)
64+
},
65+
created () {
66+
// Add this.$nuxt in child instances
67+
this.$root.$options.$nuxt = this
68+
69+
if (process.client) {
70+
// add to window so we can listen when ready
71+
window.$nuxt = this
72+
73+
this.refreshOnlineStatus()
74+
// Setup the listeners
75+
window.addEventListener('online', this.refreshOnlineStatus)
76+
window.addEventListener('offline', this.refreshOnlineStatus)
77+
}
78+
// Add $nuxt.error()
79+
this.error = this.nuxt.error
80+
// Add $nuxt.context
81+
this.context = this.$options.context
82+
},
83+
84+
async mounted () {
85+
this.$loading = this.$refs.loading
86+
},
87+
88+
watch: {
89+
'nuxt.err': 'errorChanged'
90+
},
91+
92+
computed: {
93+
isOffline () {
94+
return !this.isOnline
95+
},
96+
97+
isFetching () {
98+
return this.nbFetching > 0
99+
},
100+
101+
isPreview () {
102+
return Boolean(this.$options.previewData)
103+
},
104+
},
105+
106+
methods: {
107+
refreshOnlineStatus () {
108+
if (process.client) {
109+
if (typeof window.navigator.onLine === 'undefined') {
110+
// If the browser doesn't support connection status reports
111+
// assume that we are online because most apps' only react
112+
// when they now that the connection has been interrupted
113+
this.isOnline = true
114+
} else {
115+
this.isOnline = window.navigator.onLine
116+
}
117+
}
118+
},
119+
120+
async refresh () {
121+
const pages = getMatchedComponentsInstances(this.$route)
122+
123+
if (!pages.length) {
124+
return
125+
}
126+
this.$loading.start()
127+
128+
const promises = pages.map((page) => {
129+
const p = []
130+
131+
// Old fetch
132+
if (page.$options.fetch && page.$options.fetch.length) {
133+
p.push(promisify(page.$options.fetch, this.context))
134+
}
135+
if (page.$fetch) {
136+
p.push(page.$fetch())
137+
} else {
138+
// Get all component instance to call $fetch
139+
for (const component of getChildrenComponentInstancesUsingFetch(page.$vnode.componentInstance)) {
140+
p.push(component.$fetch())
141+
}
142+
}
143+
144+
if (page.$options.asyncData) {
145+
p.push(
146+
promisify(page.$options.asyncData, this.context)
147+
.then((newData) => {
148+
for (const key in newData) {
149+
Vue.set(page.$data, key, newData[key])
150+
}
151+
})
152+
)
153+
}
154+
155+
return Promise.all(p)
156+
})
157+
try {
158+
await Promise.all(promises)
159+
} catch (error) {
160+
this.$loading.fail(error)
161+
globalHandleError(error)
162+
this.error(error)
163+
}
164+
this.$loading.finish()
165+
},
166+
errorChanged () {
167+
if (this.nuxt.err) {
168+
if (this.$loading) {
169+
if (this.$loading.fail) {
170+
this.$loading.fail(this.nuxt.err)
171+
}
172+
if (this.$loading.finish) {
173+
this.$loading.finish()
174+
}
175+
}
176+
177+
let errorLayout = (NuxtError.options || NuxtError).layout;
178+
179+
if (typeof errorLayout === 'function') {
180+
errorLayout = errorLayout(this.context)
181+
}
182+
183+
this.setLayout(errorLayout)
184+
}
185+
},
186+
187+
setLayout (layout) {
188+
if(layout && typeof layout !== 'string') {
189+
throw new Error('[nuxt] Avoid using non-string value as layout property.')
190+
}
191+
192+
if (!layout || !layouts['_' + layout]) {
193+
layout = 'default'
194+
}
195+
this.layoutName = layout
196+
this.layout = layouts['_' + layout]
197+
return this.layout
198+
},
199+
loadLayout (layout) {
200+
if (!layout || !layouts['_' + layout]) {
201+
layout = 'default'
202+
}
203+
return Promise.resolve(layouts['_' + layout])
204+
},
205+
},
206+
207+
components: {
208+
NuxtLoading
209+
}
210+
}

0 commit comments

Comments
 (0)