<template>
  <div class="footer-fix-btn" :style="{ width }">
    <slot name="button"></slot>
  </div>
</template>

<script setup lang="ts" name="FooterFixBtn">
import { useGlobalStore } from '@/stores/modules/global'

const globalStore = useGlobalStore()
const isCollapse = computed(() => globalStore.isCollapse)
const width = ref()
watch(
  isCollapse,
  (val: boolean) => {
    if (!val) {
      width.value = window.innerWidth - 208 + 'px'
    } else {
      width.value = window.innerWidth - 50 + 'px'
    }
  },
  { immediate: true }
)
</script>

<style lang="less" scoped>
.footer-fix-btn {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background-color: var(--td-white);
  box-shadow: 0 -1px 4px var(--td-font-gray-5);
}
</style>
