Image Aurelia滚动图像显示/隐藏

Image Aurelia滚动图像显示/隐藏,image,rollover,aurelia,Image,Rollover,Aurelia,您是否可以根据用户悬停在href上的图像更改.js(aurelia)中图像的显示/隐藏?我想我需要在Bind()或Activate()中添加一些内容 比如: activate(){ $( "a" ).hover( ///find non rollover image and hide ///find rollover image and show ); //else ///find non rollover image and sh

您是否可以根据用户悬停在href上的图像更改.js(aurelia)中图像的显示/隐藏?我想我需要在Bind()或Activate()中添加一些内容

比如:

activate(){
    $( "a" ).hover(
        ///find non rollover image and hide
        ///find rollover image and show
    );
    //else
    ///find non rollover image and show
    ///find rollover image and hide
}
我真的不知道从哪里开始:-/,任何帮助都会很好:-)


将图像的源、鼠标悬停和鼠标悬停事件绑定到ViewModel:

<img mouseover.delegate="domouseover()" mouseout.delegate="domouseout()" 
 src.bind="imageUrl" />
我不确定是否可以直接绑定到图像的鼠标悬停状态


总而言之:我认为将jQuery代码与aurelia混合是个坏主意。试着为你的问题寻找一种惯用的aurelia方法。

那么你的问题是什么?谢谢Mikhail,我会看一看
<img mouseover.delegate="domouseover()" mouseout.delegate="domouseout()" 
 src.bind="imageUrl" />
imageUrl = URL1;

domouseover() {
  this.imageUrl = URL2;
}

domouseout() {
  this.imageUrl = URL1;
}