最近在一个群里有个小伙伴说 在react中不建议通过ref的形式去获取子组件的一些方法,这种方式在性能上消耗较大,所以我就想在vue中通过这方式是否会有这样的顾虑?
使用callback ref代替string ref。
callback ref
string ref
eg:
// string ref <ComponentA ref="componentA"/>
// callback ref <ComponentA ref="(com) => { this.componentA = com }"/>
2.1m questions
2.1m answers
62 comments
56.6k users