码迷,mamicode.com
首页 > 其他好文 > 详细

RichErp - vue 使用总结 - refs

时间:2018-02-10 11:14:35      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:访问   child   引用   ref   erp   数据   ring   line   计算   

<div id="parent">
<user-profile ref="profile"></user-profile>
</div>



var parent = new Vue({ el: ‘#parent‘ })
// 访问子组件实例
var child = parent.$refs.profile


当 ref 和 v-for 一起使用时,获取到的引用会是一个数组,包含和循环数据源对应的子组件。

$refs 只在组件渲染完成后才填充,并且它是非响应式的。它仅仅是一个直接操作子组件的应急方案——应当避免在模板或计算属性中使用 $refs


RichErp - vue 使用总结 - refs

标签:访问   child   引用   ref   erp   数据   ring   line   计算   

原文地址:https://www.cnblogs.com/richerp/p/8438002.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!