KRL: using a defaction parameter in an emit block
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>"); |>
}
精彩评论