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

您所在的位置:网站首页 $parent和$children 关于Vue中$refs、$parent、$children的使用

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

#关于Vue中$refs、$parent、$children的使用| 来源: 网络整理| 查看: 265

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

图片: https://uploader.shimo.im/f/AokazPJKOtVABLQz.png

$parent的使用 在子组件上使用 p a r e n t t h i s . parent this. parentthis.parent.text=’ ’ 使用或者修改 图片: https://uploader.shimo.im/f/s6v8X8tWsWFa4RCO.png

c h i l d r e n 的 使 用 在 父 组 件 上 使 用 t h i s . children的使用 在父组件上使用 this. children的使用在父组件上使用this.children.sonText 父组件内如果有好几个子组件 返回一个数组 1 不知道数组第几个 遍历找到sonText的值; 2 知道下标进行查找 图片: https://uploader.shimo.im/f/r2fRpl1nEjcav1sO.png



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3