<template>
    <div @click="max">
        <svg-icon :icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'" />
    </div>
</template>

<script setup>
import { useFullscreen } from '@vueuse/core';
import { onMounted, ref } from 'vue';
import useSettingsStore from '@/store/modules/settings';
const settingsStore = useSettingsStore();
const { isFullscreen, enter, exit, toggle } = useFullscreen();

//获取dom
let navbar = null;
let app_main = null;
let headers = null;
let leftWra = null;
let rightWra = null;
let flag = ref(true);
let leftment = null;
let main_container = null;
onMounted(() => {
    navbar = document.querySelector('.navDiv');
    app_main = document.querySelector('.app-main');
    headers = document.querySelector('.headers');
    leftWra = document.querySelector('.leftWra');
    rightWra = document.querySelector('.rightWra');
    leftment = document.querySelector('.leftment');
    main_container = document.querySelector('.main-container');
});
//隐藏导航栏
const max = () => {
    navbar.style.display = 'none';
    app_main.style.height = '100%';
    headers.style.transform = `translate(0, 0)`;
    leftment.style.display = 'none';
    main_container.style.marginLeft = '0';
    document.querySelector('.leftWra').style.top = '80px';
    document.querySelector('.rightWra').style.top = '80px';
    // settingsStore.changeSetting({ key: 'topNav', value: flag.value });
};
</script>

<style lang="scss" scoped>
.screenfull-svg {
    display: inline-block;
    cursor: pointer;
    fill: #5a5e66;
    width: 20px;
    height: 20px;
    vertical-align: 10px;
}
</style>
