<template>
  <div>
    <router-view></router-view>
  </div>
</template>

<script>
import { ref, onMounted } from "vue"
export default {
  name: 'App',
  setup() {
    onMounted(() => {
      document.title = 'SCD检测'
      // 创建一个 link 元素
      const link = document.createElement('link');
      link.rel = 'icon';
      link.type = 'image/x-icon';
      link.href = '../../assets/icon/Avatar.png'; // 替换为你的图标路径
      // 获取当前文档中原有的 link 元素
      const existingLink = document.querySelector('link[rel="icon"]');
      // 如果存在原有的 link 元素，则替换它；否则，将新创建的 link 元素添加到 head 中
      if (existingLink) {
        document.head.removeChild(existingLink);
      }
      document.head.appendChild(link);
      // 解决报错ResizeObserver loop completed with undelivered notifications.
      const debounce = (fn, delay) => {
        let timer = null;
        return function () {
          let context = this;
          let args = arguments;
          clearTimeout(timer);
          timer = setTimeout(function () {
            fn.apply(context, args);
          }, delay);
        }
      }
      const _ResizeObserver = window.ResizeObserver;
      window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
        constructor(callback) {
          callback = debounce(callback, 16);
          super(callback);
        }
      }

    })
  },
  components: {
  }
}
</script>

<style>
body {
  margin: 0;
  background-color: #FFF;
}
</style>
