MyGit

1.2.8

vanjs-org/van

版本发布时间: 2024-01-24 07:14:59

vanjs-org/van最新发布版本:1.5.2(2024-08-20 05:09:27)

In this release, we changed the implementation of event handlers in VanJS. Instead of registering event handlers via on... property, we changed to use addEventListener and removeEventListener to register and unregister event handlers.

As a result of the change, you can set custom event handlers via tag functions:

const {button, div, p} = van.tags

const dom = div(button({oncustom: () => van.add(dom, p("Event triggered!"))}, "Button"))
van.add(document.body, dom)

dom.querySelector("button").dispatchEvent(new Event("custom"))

相关地址:原始地址 下载(tar) 下载(zip)

查看:2024-01-24发行的版本