function with bind will lose efficacy on template
Vue version
3.2.37
Link to minimal reproduction
Steps to reproduce
click btn1/2/3/4
What is expected?
3
What is actually happening?
4
System Info
No response
Any additional comments?
btn2 render
_createElementVNode("button", {
onClick: _cache[0] || (_cache[0] = $event => (toggleDark.bind(this)))
}, " btn 2"),
it should be
_createElementVNode("button", {
onClick: _cache[0] || (_cache[0] = $event => (toggleDark.bind(this)()))
}, " btn 2"),
This is expected behavior. We only invoke the handler when it's a property name/path, or it's a function literal.
<button @click="f"> btn 1</button>
<button @click="f.bind()"> btn 2</button>
<button @click="f()"> btn 3</button>
<button @click="f.bind()()"> btn 4</button>
而且从js语法上来看 这四种应该也是没区别的 vue也应该做出相应的回应吧 谢谢