Nuxt/lib/app/App.vue
Sébastien Chopin 9ebbb14eab Version 0.2.0
- Add README for examples vuex-store, async-data and global-css
- Add examples/global-css/
- Feature: we can now use nuxt.config.js to add global css files and
modules
- Fix: show webpack error of compilation
2016-11-07 23:26:53 +01:00

45 lines
1.0 KiB
Vue

<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) { %>
if (this.err && this.$loading && this.$loading.fail) {
this.$loading.fail()
}
<% } %>
return this.err
}
},
components: {
ErrorPage<%= (loading ? ',\n\t\tLoading' : '') %>
}
}
</script>
<% css.forEach(function (c) { %>
<style src="<%= (typeof c === 'string' ? c : c.src) %>" lang="<%= (c.lang ? c.lang : 'css') %>"></style>
<% }) %>