<template>
    <div id="app">
        <router-view v-if="isRouterAlive"></router-view>
    </div>
</template>
<script>
export default {
    data() {
        return {
            isRouterAlive: true
        };
    },
    methods: {
        //   inject: ['reload'],   在页面中注入此方法，  使用this.reload() 达到F5的效果
        reload() {
            this.isRouterAlive = false;
            this.$nextTick(function () {
                this.isRouterAlive = true;
            });
        }
    },
    provide() {
        return {
            reload: this.reload
        };
    },
    mounted() {
        const screenWidth = window.innerWidth;
        let bodyStyle = document.body.style;
        bodyStyle.transform = `scale(${screenWidth / 4224})`;

        window.addEventListener('resize', () => {
            const screenWidth = window.innerWidth;
            let bodyStyle = document.body.style;
            bodyStyle.transform = `scale(${screenWidth / 4224})`;
        });

        // let bodyStyle = document.body.style
        // if (document.documentElement.clientWidth / document.documentElement.clientHeight < 4224 / 1152) {
        //     bodyStyle.transform= scale((window.innerWidth - 17) / 4224);
        //     // this.scale = document.documentElement.clientHeight /1080
        // } else {
        //     bodyStyle.transform= scale((window.innerWidth - 17) / 4224);
        // }
        // window.addEventListener('resize', () => {
        //     let bodyStyle = document.body.style
        //     if (document.documentElement.clientWidth / document.documentElement.clientHeight < 4224 / 1152) {
        //         bodyStyle.transform= scale((window.innerWidth - 17) / 4224);
        //         // this.scale = document.documentElement.clientHeight /1080
        //     } else {
        //         bodyStyle.transform= scale((window.innerWidth - 17) / 4224);

        //         // this.scale = document.documentElement.clientWidth / 4224;
        //     }
        // })
    },
    beforeMount() {}
};
</script>
<style lang="less">
* {
    margin: 0;
    padding: 0;
}

body {
    width: 4224px;
    height: 1152px;
    position: fixed;
    left: 0;
    top: 0;
    overflow: hidden;
    background-color: rgb(27, 28, 30);
    transform-origin: left top;
}
</style>
