<!--
 * @Date: 2022-01-19 10:08:26
 * @LastEditors: JinxChen
 * @LastEditTime: 2023-09-21 09:44:42
 * @FilePath: \TelpoH5FrontendWeb\src\App.vue
 * @description:
-->
<template>
    <div id="app">
        <router-view v-if="isRouterAlive" />
    </div>
</template>

<script>
import { VERSION_MODEL } from './config/models';
export default {
    provide() {
            return {
                reload: this.reload
            }
        },
    data() {
            return {
                isRouterAlive: true,
            }
        },
        mounted() {
            this.debug();
            console.log("当前版本号::", VERSION_MODEL, "当前环境::", process.env.NODE_ENV);

        },
        methods: {
            reload() {
                this.isRouterAlive = false;
                this.$nextTick(() => {
                    this.isRouterAlive = true;
                });
            },
            debug() {
                if (process.env.NODE_ENV !== 'production') {
                    const script = document.createElement('script');
                    script.src = "//cdn.jsdelivr.net/npm/eruda";
                    document.body.appendChild(script);
                    script.onload = function () {
                        try {
                            window.eruda.init();
                        } catch (e) {
                            console.log(e);
                        }
                    }
                }
            }
        }
}
</script>

<style lang="scss">
#app {
    text-align: center;
    color: #2c3e50;
    height: 100vh;
    width: 100%;
    background-color: #f7f8fa;
}
</style>
