<!--
 * @Date: 2021-11-29 11:20:34
 * @LastEditors: JinxuChen
 * @LastEditTime: 2021-12-10 10:42:56
 * @FilePath: \GpsCardAdmin\src\App.vue
 * @description:
-->
<template>
    <div id="app">
        <router-view v-if="isRouterAlive" />
    </div>
</template>

<script>
import { VersionModel } from "./utils/model";
export default {
    name: "App",
    provide() {
        return {
            reload: this.reload
        };
    },
    data() {
        return {
            isRouterAlive: true
        };
    },
    methods: {
        reload() {
            this.isRouterAlive = false;
            this.$nextTick(() => {
                this.isRouterAlive = true;
                console.log("reload");
            });
        },
        debug() {
            if (process.env.NODE_ENV !== "production" && document.body.clientWidth - 1 < 991) {
                const script = document.createElement("script");
                script.src = "//cdn.jsdelivr.net/npm/eruda";
                document.body.appendChild(script);
                script.onload = function() {
                    eruda.init();
                };
            }
        }
    },
    mounted() {
        this.debug();
        console.log("当前版本是::", VersionModel);
        console.log("当前环境是::", process.env.NODE_ENV);
    }
};
</script>
