<template>
    <div id="app" class="container-fluid">
        <router-view v-if="isRouterAlive"/>
    </div>
</template>

<script>
    import NavMenu from './nav-menu'

    export default {
        components: {
            'nav-menu': NavMenu,
        },
        provide () {    //父组件中通过provide来提供变量，在子组件中通过inject来注入变量。                                             
            return {
                reload: this.reload                                              
            }
        },
        methods: {
            reload() {
                this.isRouterAlive = false
                this.$nextTick(function () {
                    this.isRouterAlive = true
                })
            }
        },
        data() {
            return {
                isRouterAlive:true
            }
        },
        created() {
        }
    }
</script>

<style scoped>
    #app, body, html {
        width: 100%;
        height: 100%;
        font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI','Microsoft YaHei','微软雅黑', 'Microsoft JhengHei';
    }
</style>
