Appmaker 标签中的悬停事件

On Hover event in Label in Appmaker

我正在 appmaker 中创建一个应用程序,我想在其中有一些关于 onHover() 事件(在标签上)的代码,我只能看到 4 个可用事件

  1. onAttach
  2. onDetach
  3. onDataLoad
  4. 点击

如何在 onHover 事件上调用我的方法?

App Maker 不提供开箱即用的 onHover 事件处理程序,但是您可以自行为 mouseenter or mouseover 事件添加事件侦听器:

// client script
function doMagic(event) {
  // do the magic here
}

// onAttach widget's event
widget.getElement().addEventListener('mouseenter', doMagic);


// onDetach widget's event
widget.getElement().removeEventListener('mouseenter', doMagic);