开发者

KRL: using a defaction parameter in an emit block

开发者 https://www.devze.com 2023-02-22 14:24 出处:网络
I tried using a parameter in an emit block within a user defined action like this: my_action = defaction(css_class) {

I tried using a parameter in an emit block within a user defined action like this:

my_action = defaction(css_class) {
    emit 开发者_JAVA技巧<| $K(css_class).append("<span>!!</span>"); |>
}

but when that runs you see a console message "css_class is not defined".

How do I set up the parameter so I can use it within the 'emit' block?


There is an environment issue with defactions that is still being resolved. Right now, simply assign a variable to your paramater and your emit will see it. So, something like this:

my_action = defaction(css_class) {
    my_class = css_class;
    emit <| $K(my_class).append("<span>!!</span>"); |>
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号