美文网首页
1、typescript屏幕缩放问题

1、typescript屏幕缩放问题

作者: wqjcarnation | 来源:发表于2024-01-03 15:55 被阅读0次

    app.vue里添加如下代码

        <script lang="ts">
        import { defineComponent } from "vue";
    
        export default defineComponent({
          setup() {
            const debounce = (callback: (...args: any[]) => void, delay: number) => {
              let tid: any;
              return function (...args: any[]) {
                const ctx = self;
                tid && clearTimeout(tid);
                tid = setTimeout(() => {
                  callback.apply(ctx, args);
                }, delay);
              };
            };
    
            const _ = (window as any).ResizeObserver;
            (window as any).ResizeObserver = class ResizeObserver extends _ {
              constructor(callback: (...args: any[]) => void) {
                callback = debounce(callback, 20);
                super(callback);
              }
            };
          },
        });
        </script>

    相关文章

      网友评论

          本文标题:1、typescript屏幕缩放问题

          本文链接:https://www.haomeiwen.com/subject/swxvndtx.html