how to pass arguments to listeners in lit-element?

限于喜欢 提交于 2020-07-03 08:00:10

问题


<div @click=${this.click_cb.bind(this, record)}>${record.msg}<div>

Is this the correct way to pass an argument to a listener?


回答1:


You should also be able to do this

<div @click=${() => this.click_cb(record)}>${record.msg}<div>


来源:https://stackoverflow.com/questions/57585862/how-to-pass-arguments-to-listeners-in-lit-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!