提交 a3c8052a authored 作者: haodaking's avatar haodaking

update

上级 f2eafcdb
import Vue from 'vue'
import { decode, parsePath, withoutBase, withoutTrailingSlash, normalizeURL } from 'ufo'
import { getMatchedComponentsInstances, getChildrenComponentInstancesUsingFetch, promisify, globalHandleError, urlJoin, sanitizeComponent } from './utils'
import NuxtError from './components/nuxt-error.vue'
import NuxtLoading from './components/nuxt-loading.vue'
import NuxtBuildIndicator from './components/nuxt-build-indicator'
import '../node_modules/element-ui/lib/theme-chalk/index.css'
import '../assets/css/base.css'
import _6f6c098b from '../layouts/default.vue'
const layouts = { "_default": sanitizeComponent(_6f6c098b) }
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,
h(NuxtBuildIndicator),
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
},
watch: {
'nuxt.err': 'errorChanged'
},
computed: {
isOffline () {
return !this.isOnline
},
isFetching () {
return this.nbFetching > 0
},
},
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 && 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
}
}
差异被折叠。
import { wrapFunctional } from './utils'
export { default as Foot } from '../../components/Foot.vue'
export { default as Head } from '../../components/Head.vue'
export { default as Link } from '../../components/Link.vue'
export { default as RightAside } from '../../components/rightAside.vue'
export { default as AboutContact } from '../../components/about/contact.vue'
export { default as AboutCulture } from '../../components/about/culture.vue'
export { default as AboutIntroduce } from '../../components/about/introduce.vue'
export { default as AboutTabNav } from '../../components/about/tabNav.vue'
export { default as AlumnusParty } from '../../components/alumnus/party.vue'
export { default as AlumnusTabNav } from '../../components/alumnus/tabNav.vue'
export { default as HomeAlumniStories } from '../../components/home/alumniStories.vue'
export { default as HomeBanner } from '../../components/home/banner.vue'
export { default as HomeDegreeEducation } from '../../components/home/degreeEducation.vue'
export { default as HomeEducationServices } from '../../components/home/educationServices.vue'
export { default as HomeHeadmasterMsg } from '../../components/home/headmasterMsg.vue'
export { default as HomeOpenClass } from '../../components/home/openClass.vue'
export { default as HomeProjectNotice } from '../../components/home/projectNotice.vue'
export { default as HomeServiceCase } from '../../components/home/serviceCase.vue'
export { default as ServicesTab } from '../../components/services/tab.vue'
export const LazyFoot = import('../../components/Foot.vue' /* webpackChunkName: "components/foot" */).then(c => wrapFunctional(c.default || c))
export const LazyHead = import('../../components/Head.vue' /* webpackChunkName: "components/head" */).then(c => wrapFunctional(c.default || c))
export const LazyLink = import('../../components/Link.vue' /* webpackChunkName: "components/link" */).then(c => wrapFunctional(c.default || c))
export const LazyRightAside = import('../../components/rightAside.vue' /* webpackChunkName: "components/right-aside" */).then(c => wrapFunctional(c.default || c))
export const LazyAboutContact = import('../../components/about/contact.vue' /* webpackChunkName: "components/about-contact" */).then(c => wrapFunctional(c.default || c))
export const LazyAboutCulture = import('../../components/about/culture.vue' /* webpackChunkName: "components/about-culture" */).then(c => wrapFunctional(c.default || c))
export const LazyAboutIntroduce = import('../../components/about/introduce.vue' /* webpackChunkName: "components/about-introduce" */).then(c => wrapFunctional(c.default || c))
export const LazyAboutTabNav = import('../../components/about/tabNav.vue' /* webpackChunkName: "components/about-tab-nav" */).then(c => wrapFunctional(c.default || c))
export const LazyAlumnusParty = import('../../components/alumnus/party.vue' /* webpackChunkName: "components/alumnus-party" */).then(c => wrapFunctional(c.default || c))
export const LazyAlumnusTabNav = import('../../components/alumnus/tabNav.vue' /* webpackChunkName: "components/alumnus-tab-nav" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeAlumniStories = import('../../components/home/alumniStories.vue' /* webpackChunkName: "components/home-alumni-stories" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeBanner = import('../../components/home/banner.vue' /* webpackChunkName: "components/home-banner" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeDegreeEducation = import('../../components/home/degreeEducation.vue' /* webpackChunkName: "components/home-degree-education" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeEducationServices = import('../../components/home/educationServices.vue' /* webpackChunkName: "components/home-education-services" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeHeadmasterMsg = import('../../components/home/headmasterMsg.vue' /* webpackChunkName: "components/home-headmaster-msg" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeOpenClass = import('../../components/home/openClass.vue' /* webpackChunkName: "components/home-open-class" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeProjectNotice = import('../../components/home/projectNotice.vue' /* webpackChunkName: "components/home-project-notice" */).then(c => wrapFunctional(c.default || c))
export const LazyHomeServiceCase = import('../../components/home/serviceCase.vue' /* webpackChunkName: "components/home-service-case" */).then(c => wrapFunctional(c.default || c))
export const LazyServicesTab = import('../../components/services/tab.vue' /* webpackChunkName: "components/services-tab" */).then(c => wrapFunctional(c.default || c))
<template>
<transition appear>
<div v-if="building" class="nuxt__build_indicator" :style="indicatorStyle">
<svg viewBox="0 0 96 72" version="1" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M6 66h23l1-3 21-37L40 6 6 66zM79 66h11L62 17l-5 9 22 37v3zM54 31L35 66h38z" />
<path d="M29 69v-1-2H6L40 6l11 20 3-6L44 3s-2-3-4-3-3 1-5 3L1 63c0 1-2 3 0 6 0 1 2 2 5 2h28c-3 0-4-1-5-2z" fill="#00C58E" />
<path d="M95 63L67 14c0-1-2-3-5-3-1 0-3 0-4 3l-4 6 3 6 5-9 28 49H79a5 5 0 0 1 0 3c-2 2-5 2-5 2h16c1 0 4 0 5-2 1-1 2-3 0-6z" fill="#00C58E" />
<path d="M79 69v-1-2-3L57 26l-3-6-3 6-21 37-1 3a5 5 0 0 0 0 3c1 1 2 2 5 2h40s3 0 5-2zM54 31l19 35H35l19-35z" fill="#FFF" fill-rule="nonzero" />
</g>
</svg>
{{ animatedProgress }}%
</div>
</transition>
</template>
<script>
export default {
name: 'NuxtBuildIndicator',
data () {
return {
building: false,
progress: 0,
animatedProgress: 0,
reconnectAttempts: 0
}
},
computed: {
options: () => ({"position":"bottom-right","backgroundColor":"#2E495E","color":"#00C48D"}),
indicatorStyle () {
const [d1, d2] = this.options.position.split('-')
return {
[d1]: '20px',
[d2]: '20px',
'background-color': this.options.backgroundColor,
color: this.options.color
}
}
},
watch: {
progress (val, oldVal) {
// Average progress may decrease but ignore it!
if (val < oldVal) {
return
}
// Cancel old animation
clearInterval(this._progressAnimation)
// Jump to edge immediately
if (val < 10 || val > 90) {
this.animatedProgress = val
return
}
// Animate to value
this._progressAnimation = setInterval(() => {
const diff = this.progress - this.animatedProgress
if (diff > 0) {
this.animatedProgress++
} else {
clearInterval(this._progressAnimation)
}
}, 50)
}
},
mounted () {
if (EventSource === undefined) {
return // Unsupported
}
this.sseConnect()
},
beforeDestroy () {
this.sseClose()
clearInterval(this._progressAnimation)
},
methods: {
sseConnect () {
if (this._connecting) {
return
}
this._connecting = true
this.sse = new EventSource('/_loading/sse')
this.sse.addEventListener('message', event => this.onSseMessage(event))
},
onSseMessage (message) {
const data = JSON.parse(message.data)
if (!data.states) {
return
}
this.progress = Math.round(data.states.reduce((p, s) => p + s.progress, 0) / data.states.length)
if (!data.allDone) {
this.building = true
} else {
this.$nextTick(() => {
this.building = false
this.animatedProgress = 0
this.progress = 0
clearInterval(this._progressAnimation)
})
}
},
sseClose () {
if (this.sse) {
this.sse.close()
delete this.sse
}
}
}
}
</script>
<style scoped>
.nuxt__build_indicator {
box-sizing: border-box;
position: fixed;
font-family: monospace;
padding: 5px 10px;
border-radius: 5px;
box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.2);
width: 88px;
z-index: 2147483647;
font-size: 16px;
line-height: 1.2rem;
}
.v-enter-active, .v-leave-active {
transition-delay: 0.2s;
transition-property: all;
transition-duration: 0.3s;
}
.v-leave-to {
opacity: 0;
transform: translateY(20px);
}
svg {
display: inline-block;
vertical-align: baseline;
width: 1.1em;
height: 0.825em;
position: relative;
top: 1px;
}
</style>
export default {
name: 'NuxtChild',
functional: true,
props: {
nuxtChildKey: {
type: String,
default: ''
},
keepAlive: Boolean,
keepAliveProps: {
type: Object,
default: undefined
}
},
render (_, { parent, data, props }) {
const h = parent.$createElement
data.nuxtChild = true
const _parent = parent
const transitions = parent.$nuxt.nuxt.transitions
const defaultTransition = parent.$nuxt.nuxt.defaultTransition
let depth = 0
while (parent) {
if (parent.$vnode && parent.$vnode.data.nuxtChild) {
depth++
}
parent = parent.$parent
}
data.nuxtChildDepth = depth
const transition = transitions[depth] || defaultTransition
const transitionProps = {}
transitionsKeys.forEach((key) => {
if (typeof transition[key] !== 'undefined') {
transitionProps[key] = transition[key]
}
})
const listeners = {}
listenersKeys.forEach((key) => {
if (typeof transition[key] === 'function') {
listeners[key] = transition[key].bind(_parent)
}
})
if (process.client) {
// Add triggerScroll event on beforeEnter (fix #1376)
const beforeEnter = listeners.beforeEnter
listeners.beforeEnter = (el) => {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
if (beforeEnter) {
return beforeEnter.call(_parent, el)
}
}
}
// make sure that leave is called asynchronous (fix #5703)
if (transition.css === false) {
const leave = listeners.leave
// only add leave listener when user didnt provide one
// or when it misses the done argument
if (!leave || leave.length < 2) {
listeners.leave = (el, done) => {
if (leave) {
leave.call(_parent, el)
}
_parent.$nextTick(done)
}
}
}
let routerView = h('routerView', data)
if (props.keepAlive) {
routerView = h('keep-alive', { props: props.keepAliveProps }, [routerView])
}
return h('transition', {
props: transitionProps,
on: listeners
}, [routerView])
}
}
const transitionsKeys = [
'name',
'mode',
'appear',
'css',
'type',
'duration',
'enterClass',
'leaveClass',
'appearClass',
'enterActiveClass',
'enterActiveClass',
'leaveActiveClass',
'appearActiveClass',
'enterToClass',
'leaveToClass',
'appearToClass'
]
const listenersKeys = [
'beforeEnter',
'enter',
'afterEnter',
'enterCancelled',
'beforeLeave',
'leave',
'afterLeave',
'leaveCancelled',
'beforeAppear',
'appear',
'afterAppear',
'appearCancelled'
]
<template>
<div class="__nuxt-error-page">
<div class="error">
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48">
<path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z" />
</svg>
<div class="title">{{ message }}</div>
<p v-if="statusCode === 404" class="description">
<a v-if="typeof $route === 'undefined'" class="error-link" href="/"></a>
<NuxtLink v-else class="error-link" to="/">Back to the home page</NuxtLink>
</p>
<p class="description" v-else>An error occurred while rendering the page. Check developer tools console for details.</p>
<div class="logo">
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt</a>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'NuxtError',
props: {
error: {
type: Object,
default: null
}
},
computed: {
statusCode () {
return (this.error && this.error.statusCode) || 500
},
message () {
return this.error.message || 'Error'
}
},
head () {
return {
title: this.message,
meta: [
{
name: 'viewport',
content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0'
}
]
}
}
}
</script>
<style>
.__nuxt-error-page {
padding: 1rem;
background: #F7F8FB;
color: #47494E;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-family: sans-serif;
font-weight: 100 !important;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.__nuxt-error-page .error {
max-width: 450px;
}
.__nuxt-error-page .title {
font-size: 1.5rem;
margin-top: 15px;
color: #47494E;
margin-bottom: 8px;
}
.__nuxt-error-page .description {
color: #7F828B;
line-height: 21px;
margin-bottom: 10px;
}
.__nuxt-error-page a {
color: #7F828B !important;
text-decoration: none;
}
.__nuxt-error-page .logo {
position: fixed;
left: 12px;
bottom: 12px;
}
</style>
import Vue from 'vue'
const requestIdleCallback = window.requestIdleCallback ||
function (cb) {
const start = Date.now()
return setTimeout(function () {
cb({
didTimeout: false,
timeRemaining: () => Math.max(0, 50 - (Date.now() - start))
})
}, 1)
}
const cancelIdleCallback = window.cancelIdleCallback || function (id) {
clearTimeout(id)
}
const observer = window.IntersectionObserver && new window.IntersectionObserver((entries) => {
entries.forEach(({ intersectionRatio, target: link }) => {
if (intersectionRatio <= 0 || !link.__prefetch) {
return
}
link.__prefetch()
})
})
export default {
name: 'NuxtLink',
extends: Vue.component('RouterLink'),
props: {
prefetch: {
type: Boolean,
default: true
},
noPrefetch: {
type: Boolean,
default: false
}
},
mounted () {
if (this.prefetch && !this.noPrefetch) {
this.handleId = requestIdleCallback(this.observe, { timeout: 2e3 })
}
},
beforeDestroy () {
cancelIdleCallback(this.handleId)
if (this.__observed) {
observer.unobserve(this.$el)
delete this.$el.__prefetch
}
},
methods: {
observe () {
// If no IntersectionObserver, avoid prefetching
if (!observer) {
return
}
// Add to observer
if (this.shouldPrefetch()) {
this.$el.__prefetch = this.prefetchLink.bind(this)
observer.observe(this.$el)
this.__observed = true
}
},
shouldPrefetch () {
return this.getPrefetchComponents().length > 0
},
canPrefetch () {
const conn = navigator.connection
const hasBadConnection = this.$nuxt.isOffline || (conn && ((conn.effectiveType || '').includes('2g') || conn.saveData))
return !hasBadConnection
},
getPrefetchComponents () {
const ref = this.$router.resolve(this.to, this.$route, this.append)
const Components = ref.resolved.matched.map(r => r.components.default)
return Components.filter(Component => typeof Component === 'function' && !Component.options && !Component.__prefetched)
},
prefetchLink () {
if (!this.canPrefetch()) {
return
}
// Stop observing this link (in case of internet connection changes)
observer.unobserve(this.$el)
const Components = this.getPrefetchComponents()
for (const Component of Components) {
const componentOrPromise = Component()
if (componentOrPromise instanceof Promise) {
componentOrPromise.catch(() => {})
}
Component.__prefetched = true
}
}
}
}
import Vue from 'vue'
export default {
name: 'NuxtLink',
extends: Vue.component('RouterLink'),
props: {
prefetch: {
type: Boolean,
default: true
},
noPrefetch: {
type: Boolean,
default: false
}
}
}
<script>
export default {
name: 'NuxtLoading',
data () {
return {
percent: 0,
show: false,
canSucceed: true,
reversed: false,
skipTimerCount: 0,
rtl: false,
throttle: 200,
duration: 5000,
continuous: false
}
},
computed: {
left () {
if (!this.continuous && !this.rtl) {
return false
}
return this.rtl
? (this.reversed ? '0px' : 'auto')
: (!this.reversed ? '0px' : 'auto')
}
},
beforeDestroy () {
this.clear()
},
methods: {
clear () {
clearInterval(this._timer)
clearTimeout(this._throttle)
this._timer = null
},
start () {
this.clear()
this.percent = 0
this.reversed = false
this.skipTimerCount = 0
this.canSucceed = true
if (this.throttle) {
this._throttle = setTimeout(() => this.startTimer(), this.throttle)
} else {
this.startTimer()
}
return this
},
set (num) {
this.show = true
this.canSucceed = true
this.percent = Math.min(100, Math.max(0, Math.floor(num)))
return this
},
get () {
return this.percent
},
increase (num) {
this.percent = Math.min(100, Math.floor(this.percent + num))
return this
},
decrease (num) {
this.percent = Math.max(0, Math.floor(this.percent - num))
return this
},
pause () {
clearInterval(this._timer)
return this
},
resume () {
this.startTimer()
return this
},
finish () {
this.percent = this.reversed ? 0 : 100
this.hide()
return this
},
hide () {
this.clear()
setTimeout(() => {
this.show = false
this.$nextTick(() => {
this.percent = 0
this.reversed = false
})
}, 500)
return this
},
fail (error) {
this.canSucceed = false
return this
},
startTimer () {
if (!this.show) {
this.show = true
}
if (typeof this._cut === 'undefined') {
this._cut = 10000 / Math.floor(this.duration)
}
this._timer = setInterval(() => {
/**
* When reversing direction skip one timers
* so 0, 100 are displayed for two iterations
* also disable css width transitioning
* which otherwise interferes and shows
* a jojo effect
*/
if (this.skipTimerCount > 0) {
this.skipTimerCount--
return
}
if (this.reversed) {
this.decrease(this._cut)
} else {
this.increase(this._cut)
}
if (this.continuous) {
if (this.percent >= 100) {
this.skipTimerCount = 1
this.reversed = !this.reversed
} else if (this.percent <= 0) {
this.skipTimerCount = 1
this.reversed = !this.reversed
}
}
}, 100)
}
},
render (h) {
let el = h(false)
if (this.show) {
el = h('div', {
staticClass: 'nuxt-progress',
class: {
'nuxt-progress-notransition': this.skipTimerCount > 0,
'nuxt-progress-failed': !this.canSucceed
},
style: {
width: this.percent + '%',
left: this.left
}
})
}
return el
}
}
</script>
<style>
.nuxt-progress {
position: fixed;
top: 0px;
left: 0px;
right: 0px;
height: 2px;
width: 0%;
opacity: 1;
transition: width 0.1s, opacity 0.4s;
background-color: black;
z-index: 999999;
}
.nuxt-progress.nuxt-progress-notransition {
transition: none;
}
.nuxt-progress-failed {
background-color: red;
}
</style>
import Vue from 'vue'
import { compile } from '../utils'
import NuxtError from './nuxt-error.vue'
import NuxtChild from './nuxt-child'
export default {
name: 'Nuxt',
components: {
NuxtChild,
NuxtError
},
props: {
nuxtChildKey: {
type: String,
default: undefined
},
keepAlive: Boolean,
keepAliveProps: {
type: Object,
default: undefined
},
name: {
type: String,
default: 'default'
}
},
errorCaptured (error) {
// if we receive and error while showing the NuxtError component
// capture the error and force an immediate update so we re-render
// without the NuxtError component
if (this.displayingNuxtError) {
this.errorFromNuxtError = error
this.$forceUpdate()
}
},
computed: {
routerViewKey () {
// If nuxtChildKey prop is given or current route has children
if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) {
return this.nuxtChildKey || compile(this.$route.matched[0].path)(this.$route.params)
}
const [matchedRoute] = this.$route.matched
if (!matchedRoute) {
return this.$route.path
}
const Component = matchedRoute.components.default
if (Component && Component.options) {
const { options } = Component
if (options.key) {
return (typeof options.key === 'function' ? options.key(this.$route) : options.key)
}
}
const strict = /\/$/.test(matchedRoute.path)
return strict ? this.$route.path : this.$route.path.replace(/\/$/, '')
}
},
beforeCreate () {
Vue.util.defineReactive(this, 'nuxt', this.$root.$options.nuxt)
},
render (h) {
// if there is no error
if (!this.nuxt.err) {
// Directly return nuxt child
return h('NuxtChild', {
key: this.routerViewKey,
props: this.$props
})
}
// if an error occurred within NuxtError show a simple
// error message instead to prevent looping
if (this.errorFromNuxtError) {
this.$nextTick(() => (this.errorFromNuxtError = false))
return h('div', {}, [
h('h2', 'An error occurred while showing the error page'),
h('p', 'Unfortunately an error occurred and while showing the error page another error occurred'),
h('p', `Error details: ${this.errorFromNuxtError.toString()}`),
h('nuxt-link', { props: { to: '/' } }, 'Go back to home')
])
}
// track if we are showing the NuxtError component
this.displayingNuxtError = true
this.$nextTick(() => (this.displayingNuxtError = false))
return h(NuxtError, {
props: {
error: this.nuxt.err
}
})
}
}
import Vue from 'vue'
import { wrapFunctional } from './utils'
const components = {
Foot: () => import('../../components/Foot.vue' /* webpackChunkName: "components/foot" */).then(c => wrapFunctional(c.default || c)),
Head: () => import('../../components/Head.vue' /* webpackChunkName: "components/head" */).then(c => wrapFunctional(c.default || c)),
Link: () => import('../../components/Link.vue' /* webpackChunkName: "components/link" */).then(c => wrapFunctional(c.default || c)),
RightAside: () => import('../../components/rightAside.vue' /* webpackChunkName: "components/right-aside" */).then(c => wrapFunctional(c.default || c)),
AboutContact: () => import('../../components/about/contact.vue' /* webpackChunkName: "components/about-contact" */).then(c => wrapFunctional(c.default || c)),
AboutCulture: () => import('../../components/about/culture.vue' /* webpackChunkName: "components/about-culture" */).then(c => wrapFunctional(c.default || c)),
AboutIntroduce: () => import('../../components/about/introduce.vue' /* webpackChunkName: "components/about-introduce" */).then(c => wrapFunctional(c.default || c)),
AboutTabNav: () => import('../../components/about/tabNav.vue' /* webpackChunkName: "components/about-tab-nav" */).then(c => wrapFunctional(c.default || c)),
AlumnusParty: () => import('../../components/alumnus/party.vue' /* webpackChunkName: "components/alumnus-party" */).then(c => wrapFunctional(c.default || c)),
AlumnusTabNav: () => import('../../components/alumnus/tabNav.vue' /* webpackChunkName: "components/alumnus-tab-nav" */).then(c => wrapFunctional(c.default || c)),
HomeAlumniStories: () => import('../../components/home/alumniStories.vue' /* webpackChunkName: "components/home-alumni-stories" */).then(c => wrapFunctional(c.default || c)),
HomeBanner: () => import('../../components/home/banner.vue' /* webpackChunkName: "components/home-banner" */).then(c => wrapFunctional(c.default || c)),
HomeDegreeEducation: () => import('../../components/home/degreeEducation.vue' /* webpackChunkName: "components/home-degree-education" */).then(c => wrapFunctional(c.default || c)),
HomeEducationServices: () => import('../../components/home/educationServices.vue' /* webpackChunkName: "components/home-education-services" */).then(c => wrapFunctional(c.default || c)),
HomeHeadmasterMsg: () => import('../../components/home/headmasterMsg.vue' /* webpackChunkName: "components/home-headmaster-msg" */).then(c => wrapFunctional(c.default || c)),
HomeOpenClass: () => import('../../components/home/openClass.vue' /* webpackChunkName: "components/home-open-class" */).then(c => wrapFunctional(c.default || c)),
HomeProjectNotice: () => import('../../components/home/projectNotice.vue' /* webpackChunkName: "components/home-project-notice" */).then(c => wrapFunctional(c.default || c)),
HomeServiceCase: () => import('../../components/home/serviceCase.vue' /* webpackChunkName: "components/home-service-case" */).then(c => wrapFunctional(c.default || c)),
ServicesTab: () => import('../../components/services/tab.vue' /* webpackChunkName: "components/services-tab" */).then(c => wrapFunctional(c.default || c))
}
for (const name in components) {
Vue.component(name, components[name])
Vue.component('Lazy' + name, components[name])
}
# Discovered Components
This is an auto-generated list of components discovered by [nuxt/components](https://github.com/nuxt/components).
You can directly use them in pages and other components without the need to import them.
**Tip:** If a component is conditionally rendered with `v-if` and is big, it is better to use `Lazy` or `lazy-` prefix to lazy load.
- `<Foot>` | `<foot>` (components/Foot.vue)
- `<Head>` | `<head>` (components/Head.vue)
- `<Link>` | `<link>` (components/Link.vue)
- `<RightAside>` | `<right-aside>` (components/rightAside.vue)
- `<AboutContact>` | `<about-contact>` (components/about/contact.vue)
- `<AboutCulture>` | `<about-culture>` (components/about/culture.vue)
- `<AboutIntroduce>` | `<about-introduce>` (components/about/introduce.vue)
- `<AboutTabNav>` | `<about-tab-nav>` (components/about/tabNav.vue)
- `<AlumnusParty>` | `<alumnus-party>` (components/alumnus/party.vue)
- `<AlumnusTabNav>` | `<alumnus-tab-nav>` (components/alumnus/tabNav.vue)
- `<HomeAlumniStories>` | `<home-alumni-stories>` (components/home/alumniStories.vue)
- `<HomeBanner>` | `<home-banner>` (components/home/banner.vue)
- `<HomeDegreeEducation>` | `<home-degree-education>` (components/home/degreeEducation.vue)
- `<HomeEducationServices>` | `<home-education-services>` (components/home/educationServices.vue)
- `<HomeHeadmasterMsg>` | `<home-headmaster-msg>` (components/home/headmasterMsg.vue)
- `<HomeOpenClass>` | `<home-open-class>` (components/home/openClass.vue)
- `<HomeProjectNotice>` | `<home-project-notice>` (components/home/projectNotice.vue)
- `<HomeServiceCase>` | `<home-service-case>` (components/home/serviceCase.vue)
- `<ServicesTab>` | `<services-tab>` (components/services/tab.vue)
// nuxt/nuxt.js#8607
export function wrapFunctional(options) {
if (!options || !options.functional) {
return options
}
const propKeys = Array.isArray(options.props) ? options.props : Object.keys(options.props || {})
return {
render(h) {
const attrs = {}
const props = {}
for (const key in this.$attrs) {
if (propKeys.includes(key)) {
props[key] = this.$attrs[key]
} else {
attrs[key] = this.$attrs[key]
}
}
return h(options, {
on: this.$listeners,
attrs,
props,
scopedSlots: this.$scopedSlots,
}, this.$slots.default)
}
}
}
// This file is intentionally left empty for noop aliases
import Vue from 'vue'
import Meta from 'vue-meta'
import ClientOnly from 'vue-client-only'
import NoSsr from 'vue-no-ssr'
import { createRouter } from './router.js'
import NuxtChild from './components/nuxt-child.js'
import NuxtError from './components/nuxt-error.vue'
import Nuxt from './components/nuxt.js'
import App from './App.js'
import { setContext, getLocation, getRouteData, normalizeError } from './utils'
/* Plugins */
import nuxt_plugin_plugin_f1f94936 from 'nuxt_plugin_plugin_f1f94936' // Source: ./components/plugin.js (mode: 'all')
import nuxt_plugin_axios_2228ef02 from 'nuxt_plugin_axios_2228ef02' // Source: ../plugins/axios (mode: 'all')
import nuxt_plugin_elementui_d905880e from 'nuxt_plugin_elementui_d905880e' // Source: ../plugins/element-ui (mode: 'all')
import nuxt_plugin_vueswiper_9e702eda from 'nuxt_plugin_vueswiper_9e702eda' // Source: ../plugins/vue-swiper.js (mode: 'client')
import nuxt_plugin_tongji_4d14e27f from 'nuxt_plugin_tongji_4d14e27f' // Source: ../plugins/tongji.js (mode: 'client')
// Component: <ClientOnly>
Vue.component(ClientOnly.name, ClientOnly)
// TODO: Remove in Nuxt 3: <NoSsr>
Vue.component(NoSsr.name, {
...NoSsr,
render (h, ctx) {
if (process.client && !NoSsr._warned) {
NoSsr._warned = true
console.warn('<no-ssr> has been deprecated and will be removed in Nuxt 3, please use <client-only> instead')
}
return NoSsr.render(h, ctx)
}
})
// Component: <NuxtChild>
Vue.component(NuxtChild.name, NuxtChild)
Vue.component('NChild', NuxtChild)
// Component NuxtLink is imported in server.js or client.js
// Component: <Nuxt>
Vue.component(Nuxt.name, Nuxt)
Object.defineProperty(Vue.prototype, '$nuxt', {
get() {
const globalNuxt = this.$root.$options.$nuxt
if (process.client && !globalNuxt && typeof window !== 'undefined') {
return window.$nuxt
}
return globalNuxt
},
configurable: true
})
Vue.use(Meta, {"keyName":"head","attribute":"data-n-head","ssrAttribute":"data-n-head-ssr","tagIDKeyName":"hid"})
const defaultTransition = {"name":"page","mode":"out-in","appear":false,"appearClass":"appear","appearActiveClass":"appear-active","appearToClass":"appear-to"}
async function createApp(ssrContext, config = {}) {
const router = await createRouter(ssrContext, config)
// Create Root instance
// here we inject the router and store to all child components,
// making them available everywhere as `this.$router` and `this.$store`.
const app = {
head: {"title":"紫荆教育-专注国际学位教育-清华控股旗下在线教育品牌","htmlAttrs":{"lang":"en"},"meta":[{"charset":"utf-8"},{"name":"viewport","id":"viewport","content":"initial-scale=-1,maximum-scale=1,shrink-to-fit=no"},{"hid":"description","name":"description","content":""},{"name":"keywords","content":"工商管理硕士,MBA硕士,免联考MBA,国际MBA,通用MBA,在职MBA,在线MBA,MBA,美国MBA,金融硕士,金融硕士,心理学硕士,应用心理学硕士,在职心理学硕士,国际金融硕士,在职金融硕士,在线心理学硕士,在职金融硕士,国际金融硕士,美国金融硕士,在职应用心理学硕士,金融硕士学位,美国心理学硕士,在职工商管理硕士,酒店管理硕士,在职酒店管理硕士,理财规划师,企业理财顾问师,投资理财顾问,金融理财师,理财培训,企业融资,国家理财规划师,财富管理,资产管理,个人财富管理,证券投资,信托投资,私人财富风险管理顾问"},{"name":"description","content":"紫荆教育,专注国际学位教育,不出国、免联考在职读国际学位课程!清华控股旗下在线教育品牌-成立于2015年,全称是“清控紫荆(北京)教育科技股份有限公司”,通过在线教育的方式,将全球优质的教育资源高效、低成本的分发给每个需要的人."}],"link":[{"rel":"icon","type":"image\u002Fx-icon","href":"https:\u002F\u002Fzws-imgs-pub.ezijing.com\u002Fstatic\u002Fpublic\u002Ff56441ae1441902080226712d4d650aa.ico"}],"style":[],"script":[]},
router,
nuxt: {
defaultTransition,
transitions: [defaultTransition],
setTransitions (transitions) {
if (!Array.isArray(transitions)) {
transitions = [transitions]
}
transitions = transitions.map((transition) => {
if (!transition) {
transition = defaultTransition
} else if (typeof transition === 'string') {
transition = Object.assign({}, defaultTransition, { name: transition })
} else {
transition = Object.assign({}, defaultTransition, transition)
}
return transition
})
this.$options.nuxt.transitions = transitions
return transitions
},
err: null,
dateErr: null,
error (err) {
err = err || null
app.context._errored = Boolean(err)
err = err ? normalizeError(err) : null
let nuxt = app.nuxt // to work with @vue/composition-api, see https://github.com/nuxt/nuxt.js/issues/6517#issuecomment-573280207
if (this) {
nuxt = this.nuxt || this.$options.nuxt
}
nuxt.dateErr = Date.now()
nuxt.err = err
// Used in src/server.js
if (ssrContext) {
ssrContext.nuxt.error = err
}
return err
}
},
...App
}
const next = ssrContext ? ssrContext.next : location => app.router.push(location)
// Resolve route
let route
if (ssrContext) {
route = router.resolve(ssrContext.url).route
} else {
const path = getLocation(router.options.base, router.options.mode)
route = router.resolve(path).route
}
// Set context to app.context
await setContext(app, {
route,
next,
error: app.nuxt.error.bind(app),
payload: ssrContext ? ssrContext.payload : undefined,
req: ssrContext ? ssrContext.req : undefined,
res: ssrContext ? ssrContext.res : undefined,
beforeRenderFns: ssrContext ? ssrContext.beforeRenderFns : undefined,
ssrContext
})
function inject(key, value) {
if (!key) {
throw new Error('inject(key, value) has no key provided')
}
if (value === undefined) {
throw new Error(`inject('${key}', value) has no value provided`)
}
key = '$' + key
// Add into app
app[key] = value
// Add into context
if (!app.context[key]) {
app.context[key] = value
}
// Check if plugin not already installed
const installKey = '__nuxt_' + key + '_installed__'
if (Vue[installKey]) {
return
}
Vue[installKey] = true
// Call Vue.use() to install the plugin into vm
Vue.use(() => {
if (!Object.prototype.hasOwnProperty.call(Vue.prototype, key)) {
Object.defineProperty(Vue.prototype, key, {
get () {
return this.$root.$options[key]
}
})
}
})
}
// Inject runtime config as $config
inject('config', config)
// Add enablePreview(previewData = {}) in context for plugins
if (process.static && process.client) {
app.context.enablePreview = function (previewData = {}) {
app.previewData = Object.assign({}, previewData)
inject('preview', previewData)
}
}
// Plugin execution
if (typeof nuxt_plugin_plugin_f1f94936 === 'function') {
await nuxt_plugin_plugin_f1f94936(app.context, inject)
}
if (typeof nuxt_plugin_axios_2228ef02 === 'function') {
await nuxt_plugin_axios_2228ef02(app.context, inject)
}
if (typeof nuxt_plugin_elementui_d905880e === 'function') {
await nuxt_plugin_elementui_d905880e(app.context, inject)
}
if (process.client && typeof nuxt_plugin_vueswiper_9e702eda === 'function') {
await nuxt_plugin_vueswiper_9e702eda(app.context, inject)
}
if (process.client && typeof nuxt_plugin_tongji_4d14e27f === 'function') {
await nuxt_plugin_tongji_4d14e27f(app.context, inject)
}
// Lock enablePreview in context
if (process.static && process.client) {
app.context.enablePreview = function () {
console.warn('You cannot call enablePreview() outside a plugin.')
}
}
// Wait for async component to be resolved first
await new Promise((resolve, reject) => {
router.push(app.context.route.fullPath, resolve, (err) => {
// https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js
if (!err._isRouter) return reject(err)
if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve()
// navigated to a different route in router guard
const unregister = router.afterEach(async (to, from) => {
if (process.server && ssrContext && ssrContext.url) {
ssrContext.url = to.fullPath
}
app.context.route = await getRouteData(to)
app.context.params = to.params || {}
app.context.query = to.query || {}
unregister()
resolve()
})
})
})
return {
app,
router
}
}
export { createApp, NuxtError }
const chunks = {} // chunkId => exports
const chunksInstalling = {} // chunkId => Promise
const failedChunks = {}
function importChunk(chunkId, src) {
// Already installed
if (chunks[chunkId]) {
return Promise.resolve(chunks[chunkId])
}
// Failed loading
if (failedChunks[chunkId]) {
return Promise.reject(failedChunks[chunkId])
}
// Installing
if (chunksInstalling[chunkId]) {
return chunksInstalling[chunkId]
}
// Set a promise in chunk cache
let resolve, reject
const promise = chunksInstalling[chunkId] = new Promise((_resolve, _reject) => {
resolve = _resolve
reject = _reject
})
// Clear chunk data from cache
delete chunks[chunkId]
// Start chunk loading
const script = document.createElement('script')
script.charset = 'utf-8'
script.timeout = 120
script.src = src
let timeout
// Create error before stack unwound to get useful stacktrace later
const error = new Error()
// Complete handlers
const onScriptComplete = script.onerror = script.onload = (event) => {
// Cleanups
clearTimeout(timeout)
delete chunksInstalling[chunkId]
// Avoid mem leaks in IE
script.onerror = script.onload = null
// Verify chunk is loaded
if (chunks[chunkId]) {
return resolve(chunks[chunkId])
}
// Something bad happened
const errorType = event && (event.type === 'load' ? 'missing' : event.type)
const realSrc = event && event.target && event.target.src
error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'
error.name = 'ChunkLoadError'
error.type = errorType
error.request = realSrc
failedChunks[chunkId] = error
reject(error)
}
// Timeout
timeout = setTimeout(() => {
onScriptComplete({ type: 'timeout', target: script })
}, 120000)
// Append script
document.head.appendChild(script)
// Return promise
return promise
}
export function installJsonp() {
window.__NUXT_JSONP__ = function (chunkId, exports) { chunks[chunkId] = exports }
window.__NUXT_JSONP_CACHE__ = chunks
window.__NUXT_IMPORT__ = importChunk
}
<style>
#nuxt-loading {
background: white;
visibility: hidden;
opacity: 0;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
animation: nuxtLoadingIn 10s ease;
-webkit-animation: nuxtLoadingIn 10s ease;
animation-fill-mode: forwards;
overflow: hidden;
}
@keyframes nuxtLoadingIn {
0% {
visibility: hidden;
opacity: 0;
}
20% {
visibility: visible;
opacity: 0;
}
100% {
visibility: visible;
opacity: 1;
}
}
@-webkit-keyframes nuxtLoadingIn {
0% {
visibility: hidden;
opacity: 0;
}
20% {
visibility: visible;
opacity: 0;
}
100% {
visibility: visible;
opacity: 1;
}
}
#nuxt-loading>div,
#nuxt-loading>div:after {
border-radius: 50%;
width: 5rem;
height: 5rem;
}
#nuxt-loading>div {
font-size: 10px;
position: relative;
text-indent: -9999em;
border: .5rem solid #F5F5F5;
border-left: .5rem solid black;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: nuxtLoading 1.1s infinite linear;
animation: nuxtLoading 1.1s infinite linear;
}
#nuxt-loading.error>div {
border-left: .5rem solid #ff4500;
animation-duration: 5s;
}
@-webkit-keyframes nuxtLoading {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes nuxtLoading {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style>
<script>
window.addEventListener('error', function () {
var e = document.getElementById('nuxt-loading');
if (e) {
e.className += ' error';
}
});
</script>
<div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div>
<!-- https://projects.lukehaas.me/css-loaders -->
const middleware = {}
export default middleware
import Vue from 'vue'
import { hasFetch, normalizeError, addLifecycleHook, createGetCounter } from '../utils'
const isSsrHydration = (vm) => vm.$vnode && vm.$vnode.elm && vm.$vnode.elm.dataset && vm.$vnode.elm.dataset.fetchKey
const nuxtState = window.__NUXT__
export default {
beforeCreate () {
if (!hasFetch(this)) {
return
}
this._fetchDelay = typeof this.$options.fetchDelay === 'number' ? this.$options.fetchDelay : 200
Vue.util.defineReactive(this, '$fetchState', {
pending: false,
error: null,
timestamp: Date.now()
})
this.$fetch = $fetch.bind(this)
addLifecycleHook(this, 'created', created)
addLifecycleHook(this, 'beforeMount', beforeMount)
}
}
function beforeMount() {
if (!this._hydrated) {
return this.$fetch()
}
}
function created() {
if (!isSsrHydration(this)) {
return
}
// Hydrate component
this._hydrated = true
this._fetchKey = this.$vnode.elm.dataset.fetchKey
const data = nuxtState.fetch[this._fetchKey]
// If fetch error
if (data && data._error) {
this.$fetchState.error = data._error
return
}
// Merge data
for (const key in data) {
Vue.set(this.$data, key, data[key])
}
}
function $fetch() {
if (!this._fetchPromise) {
this._fetchPromise = $_fetch.call(this)
.then(() => { delete this._fetchPromise })
}
return this._fetchPromise
}
async function $_fetch() {
this.$nuxt.nbFetching++
this.$fetchState.pending = true
this.$fetchState.error = null
this._hydrated = false
let error = null
const startTime = Date.now()
try {
await this.$options.fetch.call(this)
} catch (err) {
if (process.dev) {
console.error('Error in fetch():', err)
}
error = normalizeError(err)
}
const delayLeft = this._fetchDelay - (Date.now() - startTime)
if (delayLeft > 0) {
await new Promise(resolve => setTimeout(resolve, delayLeft))
}
this.$fetchState.error = error
this.$fetchState.pending = false
this.$fetchState.timestamp = Date.now()
this.$nextTick(() => this.$nuxt.nbFetching--)
}
import Vue from 'vue'
import { hasFetch, normalizeError, addLifecycleHook, purifyData, createGetCounter } from '../utils'
async function serverPrefetch() {
if (!this._fetchOnServer) {
return
}
// Call and await on $fetch
try {
await this.$options.fetch.call(this)
} catch (err) {
if (process.dev) {
console.error('Error in fetch():', err)
}
this.$fetchState.error = normalizeError(err)
}
this.$fetchState.pending = false
// Define an ssrKey for hydration
this._fetchKey = this._fetchKey || this.$ssrContext.fetchCounters['']++
// Add data-fetch-key on parent element of Component
const attrs = this.$vnode.data.attrs = this.$vnode.data.attrs || {}
attrs['data-fetch-key'] = this._fetchKey
// Add to ssrContext for window.__NUXT__.fetch
if (this.$ssrContext.nuxt.fetch[this._fetchKey] !== undefined) {
console.warn(`Duplicate fetch key detected (${this._fetchKey}). This may lead to unexpected results.`)
}
this.$ssrContext.nuxt.fetch[this._fetchKey] =
this.$fetchState.error ? { _error: this.$fetchState.error } : purifyData(this._data)
}
export default {
created() {
if (!hasFetch(this)) {
return
}
if (typeof this.$options.fetchOnServer === 'function') {
this._fetchOnServer = this.$options.fetchOnServer.call(this) !== false
} else {
this._fetchOnServer = this.$options.fetchOnServer !== false
}
const defaultKey = this.$options._scopeId || this.$options.name || ''
const getCounter = createGetCounter(this.$ssrContext.fetchCounters, defaultKey)
if (typeof this.$options.fetchKey === 'function') {
this._fetchKey = this.$options.fetchKey.call(this, getCounter)
} else {
const key = 'string' === typeof this.$options.fetchKey ? this.$options.fetchKey : defaultKey
this._fetchKey = key ? key + ':' + getCounter(key) : String(getCounter(key))
}
// Added for remove vue undefined warning while ssr
this.$fetch = () => {} // issue #8043
Vue.util.defineReactive(this, '$fetchState', {
pending: true,
error: null,
timestamp: Date.now()
})
addLifecycleHook(this, 'serverPrefetch', serverPrefetch)
}
}
import Vue from 'vue'
import Router from 'vue-router'
import { normalizeURL, decode } from 'ufo'
import { interopDefault } from './utils'
import scrollBehavior from './router.scrollBehavior.js'
const _57a4425d = () => interopDefault(import('../pages/alumnus/index.vue' /* webpackChunkName: "pages/alumnus/index" */))
const _6e93e90f = () => interopDefault(import('../pages/about/contact.vue' /* webpackChunkName: "pages/about/contact" */))
const _3a85a39d = () => interopDefault(import('../pages/about/culture.vue' /* webpackChunkName: "pages/about/culture" */))
const _4f4e7cce = () => interopDefault(import('../pages/about/introduce.vue' /* webpackChunkName: "pages/about/introduce" */))
const _fc431f12 = () => interopDefault(import('../pages/about/news/index.vue' /* webpackChunkName: "pages/about/news/index" */))
const _3ab33805 = () => interopDefault(import('../pages/services/college.vue' /* webpackChunkName: "pages/services/college" */))
const _ec7b1d24 = () => interopDefault(import('../pages/services/employment.vue' /* webpackChunkName: "pages/services/employment" */))
const _340d0a2b = () => interopDefault(import('../pages/services/job.vue' /* webpackChunkName: "pages/services/job" */))
const _ed96eeb2 = () => interopDefault(import('../pages/services/major.vue' /* webpackChunkName: "pages/services/major" */))
const _8727b6c2 = () => interopDefault(import('../pages/about/news/_id.vue' /* webpackChunkName: "pages/about/news/_id" */))
const _43259943 = () => interopDefault(import('../pages/index.vue' /* webpackChunkName: "pages/index" */))
const emptyFn = () => {}
Vue.use(Router)
export const routerOptions = {
mode: 'history',
base: '/',
linkActiveClass: 'nuxt-link-active',
linkExactActiveClass: 'nuxt-link-exact-active',
scrollBehavior,
routes: [{
path: "/alumnus",
component: _57a4425d,
name: "alumnus"
}, {
path: "/about/contact",
component: _6e93e90f,
name: "about-contact"
}, {
path: "/about/culture",
component: _3a85a39d,
name: "about-culture"
}, {
path: "/about/introduce",
component: _4f4e7cce,
name: "about-introduce"
}, {
path: "/about/news",
component: _fc431f12,
name: "about-news"
}, {
path: "/services/college",
component: _3ab33805,
name: "services-college"
}, {
path: "/services/employment",
component: _ec7b1d24,
name: "services-employment"
}, {
path: "/services/job",
component: _340d0a2b,
name: "services-job"
}, {
path: "/services/major",
component: _ed96eeb2,
name: "services-major"
}, {
path: "/about/news/:id",
component: _8727b6c2,
name: "about-news-id"
}, {
path: "/",
component: _43259943,
name: "index"
}],
fallback: false
}
export function createRouter (ssrContext, config) {
const base = (config._app && config._app.basePath) || routerOptions.base
const router = new Router({ ...routerOptions, base })
// TODO: remove in Nuxt 3
const originalPush = router.push
router.push = function push (location, onComplete = emptyFn, onAbort) {
return originalPush.call(this, location, onComplete, onAbort)
}
const resolve = router.resolve.bind(router)
router.resolve = (to, current, append) => {
if (typeof to === 'string') {
to = normalizeURL(to)
}
return resolve(to, current, append)
}
return router
}
import { getMatchedComponents, setScrollRestoration } from './utils'
if (process.client) {
if ('scrollRestoration' in window.history) {
setScrollRestoration('manual')
// reset scrollRestoration to auto when leaving page, allowing page reload
// and back-navigation from other pages to use the browser to restore the
// scrolling position.
window.addEventListener('beforeunload', () => {
setScrollRestoration('auto')
})
// Setting scrollRestoration to manual again when returning to this page.
window.addEventListener('load', () => {
setScrollRestoration('manual')
})
}
}
function shouldScrollToTop(route) {
const Pages = getMatchedComponents(route)
if (Pages.length === 1) {
const { options = {} } = Pages[0]
return options.scrollToTop !== false
}
return Pages.some(({ options }) => options && options.scrollToTop)
}
export default function (to, from, savedPosition) {
// If the returned position is falsy or an empty object, will retain current scroll position
let position = false
const isRouteChanged = to !== from
// savedPosition is only available for popstate navigations (back button)
if (savedPosition) {
position = savedPosition
} else if (isRouteChanged && shouldScrollToTop(to)) {
position = { x: 0, y: 0 }
}
const nuxt = window.$nuxt
if (
// Initial load (vuejs/vue-router#3199)
!isRouteChanged ||
// Route hash changes
(to.path === from.path && to.hash !== from.hash)
) {
nuxt.$nextTick(() => nuxt.$emit('triggerScroll'))
}
return new Promise((resolve) => {
// wait for the out transition to complete (if necessary)
nuxt.$once('triggerScroll', () => {
// coords will be used if no selector is provided,
// or if the selector didn't match any element.
if (to.hash) {
let hash = to.hash
// CSS.escape() is not supported with IE and Edge.
if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
hash = '#' + window.CSS.escape(hash.substr(1))
}
try {
if (document.querySelector(hash)) {
// scroll to anchor by returning the selector
position = { selector: hash }
}
} catch (e) {
console.warn('Failed to save scroll position. Please add CSS.escape() polyfill (https://github.com/mathiasbynens/CSS.escape).')
}
}
resolve(position)
})
})
}
[
{
"name": "alumnus",
"path": "/alumnus",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/alumnus/index.vue",
"chunkName": "pages/alumnus/index"
},
{
"name": "about-contact",
"path": "/about/contact",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/about/contact.vue",
"chunkName": "pages/about/contact"
},
{
"name": "about-culture",
"path": "/about/culture",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/about/culture.vue",
"chunkName": "pages/about/culture"
},
{
"name": "about-introduce",
"path": "/about/introduce",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/about/introduce.vue",
"chunkName": "pages/about/introduce"
},
{
"name": "about-news",
"path": "/about/news",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/about/news/index.vue",
"chunkName": "pages/about/news/index"
},
{
"name": "services-college",
"path": "/services/college",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/services/college.vue",
"chunkName": "pages/services/college"
},
{
"name": "services-employment",
"path": "/services/employment",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/services/employment.vue",
"chunkName": "pages/services/employment"
},
{
"name": "services-job",
"path": "/services/job",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/services/job.vue",
"chunkName": "pages/services/job"
},
{
"name": "services-major",
"path": "/services/major",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/services/major.vue",
"chunkName": "pages/services/major"
},
{
"name": "about-news-id",
"path": "/about/news/:id",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/about/news/_id.vue",
"chunkName": "pages/about/news/_id"
},
{
"name": "index",
"path": "/",
"component": "/Users/max/gitlab/ezijing-www-pc/pages/index.vue",
"chunkName": "pages/index"
}
]
import Vue from 'vue'
import { joinURL, normalizeURL, withQuery } from 'ufo'
import fetch from 'node-fetch'
import middleware from './middleware.js'
import {
applyAsyncData,
middlewareSeries,
sanitizeComponent,
getMatchedComponents,
promisify
} from './utils.js'
import fetchMixin from './mixins/fetch.server'
import { createApp, NuxtError } from './index.js'
import NuxtLink from './components/nuxt-link.server.js' // should be included after ./index.js
// Update serverPrefetch strategy
Vue.config.optionMergeStrategies.serverPrefetch = Vue.config.optionMergeStrategies.created
// Fetch mixin
if (!Vue.__nuxt__fetch__mixin__) {
Vue.mixin(fetchMixin)
Vue.__nuxt__fetch__mixin__ = true
}
if (!Vue.__original_use__) {
Vue.__original_use__ = Vue.use
Vue.__install_times__ = 0
Vue.use = function (plugin, ...args) {
plugin.__nuxt_external_installed__ = Vue._installedPlugins.includes(plugin)
return Vue.__original_use__(plugin, ...args)
}
}
if (Vue.__install_times__ === 2) {
Vue.__install_times__ = 0
Vue._installedPlugins = Vue._installedPlugins.filter(plugin => {
return plugin.__nuxt_external_installed__ === true
})
}
Vue.__install_times__++
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
Vue.component('NLink', NuxtLink)
if (!global.fetch) { global.fetch = fetch }
const noopApp = () => new Vue({ render: h => h('div', { domProps: { id: '__nuxt' } }) })
const createNext = ssrContext => (opts) => {
// If static target, render on client-side
ssrContext.redirected = opts
if (ssrContext.target === 'static' || !ssrContext.res) {
ssrContext.nuxt.serverRendered = false
return
}
let fullPath = withQuery(opts.path, opts.query)
const $config = ssrContext.runtimeConfig || {}
const routerBase = ($config._app && $config._app.basePath) || '/'
if (!fullPath.startsWith('http') && (routerBase !== '/' && !fullPath.startsWith(routerBase))) {
fullPath = joinURL(routerBase, fullPath)
}
// Avoid loop redirect
if (decodeURI(fullPath) === decodeURI(ssrContext.url)) {
ssrContext.redirected = false
return
}
ssrContext.res.writeHead(opts.status, {
Location: normalizeURL(fullPath)
})
ssrContext.res.end()
}
// This exported function will be called by `bundleRenderer`.
// This is where we perform data-prefetching to determine the
// state of our application before actually rendering it.
// Since data fetching is async, this function is expected to
// return a Promise that resolves to the app instance.
export default async (ssrContext) => {
// Create ssrContext.next for simulate next() of beforeEach() when wanted to redirect
ssrContext.redirected = false
ssrContext.next = createNext(ssrContext)
// Used for beforeNuxtRender({ Components, nuxtState })
ssrContext.beforeRenderFns = []
// Nuxt object (window.{{globals.context}}, defaults to window.__NUXT__)
ssrContext.nuxt = { layout: 'default', data: [], fetch: {}, error: null, serverRendered: true, routePath: '' }
ssrContext.fetchCounters = {}
// Remove query from url is static target
// Public runtime config
ssrContext.nuxt.config = ssrContext.runtimeConfig.public
if (ssrContext.nuxt.config._app) {
__webpack_public_path__ = joinURL(ssrContext.nuxt.config._app.cdnURL, ssrContext.nuxt.config._app.assetsPath)
}
// Create the app definition and the instance (created for each request)
const { app, router } = await createApp(ssrContext, ssrContext.runtimeConfig.private)
const _app = new Vue(app)
// Add ssr route path to nuxt context so we can account for page navigation between ssr and csr
ssrContext.nuxt.routePath = app.context.route.path
// Add meta infos (used in renderer.js)
ssrContext.meta = _app.$meta()
// Keep asyncData for each matched component in ssrContext (used in app/utils.js via this.$ssrContext)
ssrContext.asyncData = {}
const beforeRender = async () => {
// Call beforeNuxtRender() methods
await Promise.all(ssrContext.beforeRenderFns.map(fn => promisify(fn, { Components, nuxtState: ssrContext.nuxt })))
}
const renderErrorPage = async () => {
// Don't server-render the page in static target
if (ssrContext.target === 'static') {
ssrContext.nuxt.serverRendered = false
}
// Load layout for error page
const layout = (NuxtError.options || NuxtError).layout
const errLayout = typeof layout === 'function' ? layout.call(NuxtError, app.context) : layout
ssrContext.nuxt.layout = errLayout || 'default'
await _app.loadLayout(errLayout)
_app.setLayout(errLayout)
await beforeRender()
return _app
}
const render404Page = () => {
app.context.error({ statusCode: 404, path: ssrContext.url, message: 'This page could not be found' })
return renderErrorPage()
}
const s = Date.now()
// Components are already resolved by setContext -> getRouteData (app/utils.js)
const Components = getMatchedComponents(app.context.route)
/*
** Call global middleware (nuxt.config.js)
*/
let midd = []
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
await middlewareSeries(midd, app.context)
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
/*
** Set layout
*/
let layout = Components.length ? Components[0].options.layout : NuxtError.layout
if (typeof layout === 'function') {
layout = layout(app.context)
}
await _app.loadLayout(layout)
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
layout = _app.setLayout(layout)
ssrContext.nuxt.layout = _app.layoutName
/*
** Call middleware (layout + pages)
*/
midd = []
layout = sanitizeComponent(layout)
if (layout.options.middleware) {
midd = midd.concat(layout.options.middleware)
}
Components.forEach((Component) => {
if (Component.options.middleware) {
midd = midd.concat(Component.options.middleware)
}
})
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
await middlewareSeries(midd, app.context)
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
/*
** Call .validate()
*/
let isValid = true
try {
for (const Component of Components) {
if (typeof Component.options.validate !== 'function') {
continue
}
isValid = await Component.options.validate(app.context)
if (!isValid) {
break
}
}
} catch (validationError) {
// ...If .validate() threw an error
app.context.error({
statusCode: validationError.statusCode || '500',
message: validationError.message
})
return renderErrorPage()
}
// ...If .validate() returned false
if (!isValid) {
// Render a 404 error page
return render404Page()
}
// If no Components found, returns 404
if (!Components.length) {
return render404Page()
}
// Call asyncData & fetch hooks on components matched by the route.
const asyncDatas = await Promise.all(Components.map((Component) => {
const promises = []
// Call asyncData(context)
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
const promise = promisify(Component.options.asyncData, app.context)
promise.then((asyncDataResult) => {
ssrContext.asyncData[Component.cid] = asyncDataResult
applyAsyncData(Component)
return asyncDataResult
})
promises.push(promise)
} else {
promises.push(null)
}
// Call fetch(context)
if (Component.options.fetch && Component.options.fetch.length) {
promises.push(Component.options.fetch(app.context))
} else {
promises.push(null)
}
return Promise.all(promises)
}))
if (process.env.DEBUG && asyncDatas.length) console.debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms')
// datas are the first row of each
ssrContext.nuxt.data = asyncDatas.map(r => r[0] || {})
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
// Call beforeNuxtRender methods & add store state
await beforeRender()
return _app
}
差异被折叠。
{
"Foot": {
"description": "Auto imported from components/Foot.vue"
},
"Head": {
"description": "Auto imported from components/Head.vue"
},
"Link": {
"description": "Auto imported from components/Link.vue"
},
"RightAside": {
"description": "Auto imported from components/rightAside.vue"
},
"AboutContact": {
"description": "Auto imported from components/about/contact.vue"
},
"AboutCulture": {
"description": "Auto imported from components/about/culture.vue"
},
"AboutIntroduce": {
"description": "Auto imported from components/about/introduce.vue"
},
"AboutTabNav": {
"description": "Auto imported from components/about/tabNav.vue"
},
"AlumnusParty": {
"description": "Auto imported from components/alumnus/party.vue"
},
"AlumnusTabNav": {
"description": "Auto imported from components/alumnus/tabNav.vue"
},
"HomeAlumniStories": {
"description": "Auto imported from components/home/alumniStories.vue"
},
"HomeBanner": {
"description": "Auto imported from components/home/banner.vue"
},
"HomeDegreeEducation": {
"description": "Auto imported from components/home/degreeEducation.vue"
},
"HomeEducationServices": {
"description": "Auto imported from components/home/educationServices.vue"
},
"HomeHeadmasterMsg": {
"description": "Auto imported from components/home/headmasterMsg.vue"
},
"HomeOpenClass": {
"description": "Auto imported from components/home/openClass.vue"
},
"HomeProjectNotice": {
"description": "Auto imported from components/home/projectNotice.vue"
},
"HomeServiceCase": {
"description": "Auto imported from components/home/serviceCase.vue"
},
"ServicesTab": {
"description": "Auto imported from components/services/tab.vue"
}
}
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
{{ APP }}
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Server error</title>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport>
<style>
.__nuxt-error-page{padding: 1rem;background:#f7f8fb;color:#47494e;text-align:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;font-family:sans-serif;font-weight:100!important;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;position:absolute;top:0;left:0;right:0;bottom:0}.__nuxt-error-page .error{max-width:450px}.__nuxt-error-page .title{font-size:24px;font-size:1.5rem;margin-top:15px;color:#47494e;margin-bottom:8px}.__nuxt-error-page .description{color:#7f828b;line-height:21px;margin-bottom:10px}.__nuxt-error-page a{color:#7f828b!important;text-decoration:none}.__nuxt-error-page .logo{position:fixed;left:12px;bottom:12px}
</style>
</head>
<body>
<div class="__nuxt-error-page">
<div class="error">
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48"><path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z"/></svg>
<div class="title">Server error</div>
<div class="description">{{ message }}</div>
</div>
<div class="logo">
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt</a>
</div>
</div>
</body>
</html>
export default function(context) {
const UA = process.server ? context.req.headers['user-agent'] : navigator.userAgent
const isMobile = /iphone/i.test(UA) || (/android/i.test(UA) && /mobile/i.test(UA))
isMobile && context.redirect('https://h5.ezijing.com/')
}
......@@ -36,7 +36,7 @@ if (process.env.NODE_ENV === 'production') {
followRedirects: true,
logLevel: 'info',
headers: {
'Referer': 'https://project-api.ezijing.com/api'
Referer: 'https://project-api.ezijing.com/api'
},
pathRewrite: {
'^/api': '/'
......@@ -77,10 +77,7 @@ export default {
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'element-ui/lib/theme-chalk/index.css',
'assets/css/base.css'
],
css: ['element-ui/lib/theme-chalk/index.css', 'assets/css/base.css'],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
......@@ -88,10 +85,12 @@ export default {
'@/plugins/element-ui',
{
// 引入一个插件,这里的 ssr 表示使用服务端渲染
src: "plugins/vue-swiper.js", ssr: false
src: 'plugins/vue-swiper.js',
ssr: false
},
{
src: "plugins/tongji.js", ssr: false
src: 'plugins/tongji.js',
ssr: false
}
],
......@@ -99,16 +98,17 @@ export default {
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: [/^element-ui/],
transpile: [/^element-ui/]
},
router: {
middleware: ['device']
}
// proxy: {
// '/api': {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论