关于Vue中$refs、$parent、$children的使用

r e f s 的 使 用 类 似 于 标 记 用 于 父 组 件 操 作 子 组 件 的 数 据 子 组 件 进 行 绑 定 r e f = " " 在 父 组 件 进 行 操 作 数 据 t h i s . refs 的使用 类似于标记 用于父组件操作子组件的数据 子组件进行绑定ref=" " 在 父组件 进行操作数据 this. refs使ref=""this.refs.son1.sonText = ‘二二二’

关于Vue中$refs、$parent、$children的使用

$parent的使用
在子组件上使用 p a r e n t t h i s . parent this. parentthis.parent.text=’ ’
使用或者修改
关于Vue中$refs、$parent、$children的使用

c h i l d r e n 的 使 用 在 父 组 件 上 使 用 t h i s . children的使用 在父组件上使用 this. children使使this.children.sonText 父组件内如果有好几个子组件 返回一个数组
1 不知道数组第几个 遍历找到sonText的值;
2 知道下标进行查找
关于Vue中$refs、$parent、$children的使用