45 lines
1.0 KiB
Vue
45 lines
1.0 KiB
Vue
|
<template>
|
||
|
<div class="my-layout" v-if="loading" >
|
||
|
<my-header ></my-header>
|
||
|
<Nuxt />
|
||
|
<my-footer></my-footer>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
import MyHeader from "../components/MyHeader/index";
|
||
|
import MyFooter from "../components/MyFooter/index";
|
||
|
export default {
|
||
|
name: "index",
|
||
|
components: {MyFooter, MyHeader },
|
||
|
data(){
|
||
|
return {
|
||
|
loading:false
|
||
|
}
|
||
|
},
|
||
|
mixins:[],
|
||
|
mounted(){
|
||
|
this.$nextTick(() => {
|
||
|
this.$nuxt.$loading.start()
|
||
|
setTimeout(async () =>{
|
||
|
await this.$nuxt.$loading.finish();
|
||
|
this.loading=!this.$nuxt.$loading.getLoadingState();
|
||
|
}, 2000)
|
||
|
})
|
||
|
},
|
||
|
async asyncData(data) {
|
||
|
const { params, $http }=data;
|
||
|
// const post = await $http.$get(`https://api.nuxtjs.dev/posts/${params.id}`)
|
||
|
return { post:'121' }
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="less">
|
||
|
.my-layout{
|
||
|
display: block;
|
||
|
height: 100%;
|
||
|
}
|
||
|
</style>
|