在elm(elm ui)中悬停时如何使文本删除线?
基本上我想让文本在悬停时删除。这对我来说并不容易在elm(elm ui)中悬停时如何使文本删除线?,elm,elm-ui,Elm,Elm Ui,基本上我想让文本在悬停时删除。这对我来说并不容易 el [ mouseOver [Font.strike] ] (text "some text") 就像对我一样 el [ mouseOver [Background.color someColor] ] (text "some other text") 因为Font.strike是属性msg而Background.color是Attr装饰msg 是否有人知道如何使用Font.strike之类的工具实现
el [ mouseOver [Font.strike] ] (text "some text")
就像对我一样
el [ mouseOver [Background.color someColor] ] (text "some other text")
因为Font.strike
是属性msg
而Background.color
是Attr装饰msg
是否有人知道如何使用Font.strike
之类的工具实现所描述的行为
如果不可能,我也会接受非
elm ui
解决方案。正如您已经指出的,mouseOver
需要Attr装饰msg
。它使用CSS
进行悬停(因此受到限制),它负责在鼠标悬停时应用样式,并在鼠标悬停时清除样式
对于一般情况,我们必须使用Element.Events
来检测鼠标在我们身上的移动。我们还需要在模型中跟踪此状态。然后我们可以根据模型有条件地应用Font.strike
属性
我们可以在元素上侦听这些事件。el
Events.onMouseEnter Enter
:: Events.onMouseLeave Leave
:: style
,其中,样式
是[Font.strike]
或[]
,具体取决于型号
此处的完整代码和工作演示:可用于。