KRL:在emit块中使用defaction参数

Ran*_*ohn 4 krl

我尝试在用户定义的操作中使用emit块中的参数,如下所示:

my_action = defaction(css_class) {
    emit <| $K(css_class).append("<span>!!</span>"); |>
}
Run Code Online (Sandbox Code Playgroud)

但是当它运行时,你会看到一个控制台消息"css_class未定义".

如何设置参数以便我可以在'emit'块中使用它?

Ale*_*lex 5

存在一个仍在解决的骚扰环境问题.现在,只需为你的参数分配一个变量,你的发射就会看到它.所以,像这样:

my_action = defaction(css_class) {
    my_class = css_class;
    emit <| $K(my_class).append("<span>!!</span>"); |>
}
Run Code Online (Sandbox Code Playgroud)