javascript - 调用 MouseLeave chartJs Angular
问题描述
我有以下代码:
角组件html
<canvas myChart>
[dataset] = "dataVariable"
[labels] = "labelVariable"
(chartHover) = "chartHover($event)"
</canvas>
组件.ts
public chartHover(e: any){
//Perform operations
}
每当我将鼠标悬停在一个元素上时,我实际上是在调用一个自定义弹出窗口。问题是我还没有找到触发mouseleave事件使组件消失的方法。
我试过这个:
(chartMouseLeave) = "funct()"
这样做的正确方法是什么?
解决方案
您可以将事件绑定到mouseout
画布的事件。
<canvas myChart>
[dataset] = "dataVariable"
[labels] = "labelVariable"
(chartHover) = "chartHover($event)"
(mouseout) = "mouseOut($event)"
</canvas>
零件
public mouseOut(event: any){
// set pop up open flag to false
}
推荐阅读
- node.js - 上传照片时,错误:发送后无法设置标题,
- javascript - React 组件的返回依赖于来自 useEffect 的数据
- python - 为什么这个列表理解只在 df.apply 中有效?
- docusignapi - 文档 | 嵌入式签名 | 谁以及何时生成“签名 URL”?
- python - ```len``` 关键字有什么作用及其定义
- wso2 - WSO2 Dashboard - Siddhi 数据提供者 - 是否可以调用一个 REST API 作为 Store?
- c - 在 C 中检查 NULL 指针分段错误
- zend-framework - 如何覆盖 Laminas XML-RPC 服务器响应的标头?
- javascript - 更改输入微调器编号并随之更改输入值
- python - 使用按月递减和递增日期列创建新列