Reputation: 485
Here is a simple version for my problem:
render (h) {
let events = {onClick: handleClick}
return (<div {...events}></div>)
}
onClick
event was not add to the div
element, and spread operator works well with class
and style
attribute but not any of the event listener bindings (starts with on
or nativeOn
). Can somebody explain why and offer me a solution that I can bind arbitrary amount of event on a element?
Upvotes: 2
Views: 1229
Reputation: 331
it should be like this:
render (h) {
const hi = function () {
console.log('hello')
}
return (
<div { ...{ on: {click: hi} } } > click me! </div>
)
}
Here the link to babel-plugin-transform-vue-jsx issues
Upvotes: 3