我想从scala js中的网页上的表单中抓取一些文本框中的数据。我已经使用HTML'` onclick事件就像试了一下:在scala js中按下按钮时抓取网页中的数据
<button id="submit" type="button" onclick="TutorialApp().fun()">Submit</button>
和我创建了一个功能,我TutorialApp对象,如:
object TutorialApp extends JSApp {
@JSExport
def main(): Unit = {
.....
}
def fun():Unit = {
println("Button is clicked")
}
但它显示错误TutorialApp()。 fun()不是一个函数。我的代码有什么问题?