2016-11-07 01:34:58 +00:00
|
|
|
<template>
|
|
|
|
<div id="app">
|
|
|
|
<% if (loading) { %><loading ref="loading"></loading><% } %>
|
|
|
|
<router-view v-if="!err"></router-view>
|
|
|
|
<error-page v-if="err" :error="err"></error-page>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ErrorPage from '<%= components.ErrorPage %>'
|
|
|
|
<% if (loading) { %>import Loading from '<%= (typeof loading === "string" ? loading : "./components/Loading.vue") %>'<% } %>
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
err: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
<% if (loading) { %>
|
|
|
|
mounted () {
|
|
|
|
this.$loading = this.$refs.loading
|
|
|
|
},
|
|
|
|
<% } %>
|
|
|
|
methods: {
|
|
|
|
error (err) {
|
|
|
|
err = err || null
|
|
|
|
this.err = err || null
|
|
|
|
<% if (loading) { %>
|
2016-11-07 18:21:32 +00:00
|
|
|
if (this.err && this.$loading && this.$loading.fail) {
|
|
|
|
this.$loading.fail()
|
2016-11-07 01:34:58 +00:00
|
|
|
}
|
|
|
|
<% } %>
|
|
|
|
return this.err
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
2016-11-07 18:21:32 +00:00
|
|
|
ErrorPage<%= (loading ? ',\n\t\tLoading' : '') %>
|
2016-11-07 01:34:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2016-11-07 22:26:53 +00:00
|
|
|
|
|
|
|
<% css.forEach(function (c) { %>
|
|
|
|
<style src="<%= (typeof c === 'string' ? c : c.src) %>" lang="<%= (c.lang ? c.lang : 'css') %>"></style>
|
|
|
|
<% }) %>
|