【问题】
使用refs触发子组件内方法时报:TypeError: this.$refs.treeRefs.xxx is not a function
【解决】
经查看,发现子组件被放在了v-for循环体
内,示例代码如下:
<view v-for="(item,index) in list">
<children ref="treeRefs"></children >
</view >
此时只需要加上下标 [0] 即可,示例代码如下:
this.$refs.treeRefs[0].xxx()
拒绝粗心大意!!!