Blazor,事件监听器作为@functions部分中的内联委托或处理程序

时间:2018-05-25 20:30:27

标签: events listener blazor

在使用内联委托或在@functions部分实现处理程序时,我得到了不同的反应(在控制台中输出)。我不明白为什么!这是一个错误或什么东西让我失望?

<input type="text" onkeyup="@(e => Console.Write(e.Key))" />

它让我在控制台中立即输出。 但是当我使用这样的处理程序时,我什么都没得到:

<input type="text" onkeyup="@showKey"/>
@functions{
    void showKey(UIKeyboardEventArgs e){
        Console.Write(e.Key);
    }
}

1 个答案:

答案 0 :(得分:2)

我们的代码都不适合我。但是当我将它们更改为import { text } from './sample.json'; console.log(text); // "some sample text"

时,请继续工作

我猜rimraf dist && webpack --bail --progress --profile --theme=<name of theme>不支持,因为浏览器不支持此功能,Console.WriteLine(e.key)转换为Console.WriteConsole.Writeline无法转换为。{/ p >