element icon indicating copy to clipboard operation
element copied to clipboard

[Bug Report] 使用高德地图和threejs配合渲染时,会出现input-number 点击加减时不生效,建议repeat指令,配置起来使用

Open zhuchaoling opened this issue 6 months ago • 1 comments

Element UI version

2.15.14

OS/Browsers version

window

Vue version

2.7.16

Reproduction Link

https://codepen.io/chaoling/pen/dPYXaeK

Steps to reproduce

忽略链接

使用高德地图和threejs配合渲染时,会出现input-number 点击加减时不生效,建议repeat指令,配置起来使用 控制台 出现这个verbose 报警告时 [Violation] 'requestAnimationFrame' handler took 120ms 点击加减号,频现不生效

What is Expected?

建议repeat指令,配置起来使用,不要全用

What is actually happening?

加减操作不生效

zhuchaoling avatar Jul 25 '25 06:07 zhuchaoling

v-repeat-click 指令源码如下,微任务累计时间不大于 maxIntervals ,会执行事件函数,反之clear

import { once, on } from 'element-ui/src/utils/dom';
import { isMac } from 'element-ui/src/utils/util';

export default {
  bind(el, binding, vnode) {
    let interval = null;
    let startTime;
    const maxIntervals = isMac() ? 100 : 200;
    const handler = () => vnode.context[binding.expression].apply();
    const clear = () => {
      if (Date.now() - startTime < maxIntervals) {
        handler();
      }
      clearInterval(interval);
      interval = null;
    };

    on(el, 'mousedown', (e) => {
      if (e.button !== 0) return;
      startTime = Date.now();
      once(document, 'mouseup', clear);
      clearInterval(interval);
      interval = setInterval(handler, maxIntervals);
    });
  }
};

zhuchaoling avatar Jul 29 '25 08:07 zhuchaoling