Native event listeners
Song-Qian opened this issue · 1 comments
Hello, I have a question in using vue-tsx-support. When I write a component, I need to complete an api function in a vue.
<input ...$listeners >
I was browsing the vue-tsx-support development documentation and found that it can be used
<Component {...{ nativeOn: {click: ...}}} />
So I changed the code to
<input type='text' value={ me.value} onInput={ (e) => me.$emit('input', e.target.value)} {...{ nativeOn: {...me .$listeners}} }>
But webpack has an error. Should I use this syntax, should I still need the relevant dependencies?
Some mistakes exist in your code.
-
input
is not a component, so you can't usenativeOn
, useon
instead.<input {...{ on: this.$listener }} />
-
In JSX, input tag must be closed.
https://stackoverflow.com/questions/30852751/expected-corresponding-jsx-closing-tag-for-input-reactjs
But these maybe not the reason of this error.
It seems your babel configuration is something wrong.