![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/node_modules/.cache/nuxt/ |
import Vue from 'vue' import { decode, parsePath, withoutBase, withoutTrailingSlash, normalizeURL } from 'ufo' import { getMatchedComponentsInstances, getChildrenComponentInstancesUsingFetch, promisify, globalHandleError, urlJoin, sanitizeComponent } from './utils' import NuxtError from '../../../layouts/error.vue' import NuxtLoading from './components/nuxt-loading.vue' import '../../bootstrap/dist/css/bootstrap.css' import '../../bootstrap-vue/dist/bootstrap-vue.css' import '../../@fortawesome/fontawesome-svg-core/styles.css' import '../../../static/css/common.css' import _6f6c098b from '../../../layouts/default.vue' import _775209f9 from '../../../layouts/forms.vue' const layouts = { "_default": sanitizeComponent(_6f6c098b),"_forms": sanitizeComponent(_775209f9) } export default { 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, transitionEl ]) }, data: () => ({ isOnline: true, layout: null, layoutName: '', nbFetching: 0 }), beforeCreate () { Vue.util.defineReactive(this, 'nuxt', this.$options.nuxt) }, created () { // Add this.$nuxt in child instances this.$root.$options.$nuxt = this if (process.client) { // add to window so we can listen when ready 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 // Add $nuxt.context this.context = this.$options.context }, async mounted () { this.$loading = this.$refs.loading if (this.isPreview) { if (this.$store && this.$store._actions.nuxtServerInit) { this.$loading.start() await this.$store.dispatch('nuxtServerInit', this.context) } await this.refresh() this.$loading.finish() } }, watch: { 'nuxt.err': 'errorChanged' }, computed: { isOffline () { return !this.isOnline }, isFetching () { return this.nbFetching > 0 }, isPreview () { return Boolean(this.$options.previewData) }, }, 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 } } }, async refresh () { const pages = getMatchedComponentsInstances(this.$route) if (!pages.length) { return } this.$loading.start() const promises = pages.map((page) => { const p = [] // Old fetch if (page.$options.fetch && page.$options.fetch.length) { p.push(promisify(page.$options.fetch, this.context)) } if (page.$fetch) { p.push(page.$fetch()) } else { // Get all component instance to call $fetch for (const component of getChildrenComponentInstancesUsingFetch(page.$vnode.componentInstance)) { p.push(component.$fetch()) } } if (page.$options.asyncData) { p.push( promisify(page.$options.asyncData, this.context) .then((newData) => { for (const key in newData) { Vue.set(page.$data, key, newData[key]) } }) ) } return Promise.all(p) }) try { await Promise.all(promises) } catch (error) { this.$loading.fail(error) globalHandleError(error) this.error(error) } this.$loading.finish() }, errorChanged () { if (this.nuxt.err) { if (this.$loading) { if (this.$loading.fail) { this.$loading.fail(this.nuxt.err) } if (this.$loading.finish) { this.$loading.finish() } } let errorLayout = (NuxtError.options || NuxtError).layout; if (typeof errorLayout === 'function') { errorLayout = errorLayout(this.context) } this.setLayout(errorLayout) } }, setLayout (layout) { 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]) }, getRouterBase() { return withoutTrailingSlash(this.$router.options.base) }, getRoutePath(route = '/') { const base = this.getRouterBase() return withoutTrailingSlash(withoutBase(parsePath(route).pathname, base)) }, getStaticAssetsPath(route = '/') { const { staticAssetsBase } = window.__NUXT__ return urlJoin(staticAssetsBase, this.getRoutePath(route)) }, async fetchStaticManifest() { return window.__NUXT_IMPORT__('manifest.js', normalizeURL(urlJoin(this.getStaticAssetsPath(), 'manifest.js'))) }, setPagePayload(payload) { this._pagePayload = payload this._fetchCounters = {} }, async fetchPayload(route, prefetch) { const path = decode(this.getRoutePath(route)) const manifest = await this.fetchStaticManifest() if (!manifest.routes.includes(path)) { if (!prefetch) { this.setPagePayload(false) } throw new Error(`Route ${path} is not pre-rendered`) } const src = urlJoin(this.getStaticAssetsPath(route), 'payload.js') try { const payload = await window.__NUXT_IMPORT__(path, normalizeURL(src)) if (!prefetch) { this.setPagePayload(payload) } return payload } catch (err) { if (!prefetch) { this.setPagePayload(false) } throw err } } }, components: { NuxtLoading } }