Skip to content

🐞为什么使用 cdn 和使用 npm 包导入的行为会不同? #5062

Description

@Dedicatus546

问题描述

同样监听 cell:mouseenter ,npm 引入的正常触发, cdn 引入的不触发,这是什么奇怪的 bug ,是我使用的方式有问题吗。。。

代码:

const graph = new Graph({
  container: document.getElementById("container") as HTMLElement,
  width: 800,
  height: 600,
  grid: true,
});

graph.addNode({
  shape: "image",
  x: 320,
  y: 120,
  width: 94,
  height: 28,
  imageUrl:
    "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
});

graph.on("cell:mouseenter", (data) => {
  console.log("mouseenter", data);
});
graph.on("cell:mouseleave", (data) => {
  console.log("mouseleave", data);
});

其中 cdn 引入使用 X6.Graph ,npm 引入使用 import { Graph } from "@antv/x6"

重现链接

https://codesandbox.io/p/sandbox/g9v9pm

重现步骤

  1. 进入页面
  2. 移入 cdn 下的 antv 节点,没有弹出 alert
  3. 移入 npm 下的 antv 节点,弹出 alert

预期行为

cdn 引入的 antv 节点也应该弹出 alert

平台

  • 操作系统: [Windows]
  • 网页浏览器: [Google Chrome]
  • X6 版本: [3.1.7]

屏幕截图或视频(可选但最好有)

No response

补充说明(可选)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for maintainerTriage or intervention needed from a maintainer

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions