[Vuejs] 给ref赋值需要注意的问题
时间:2019-07-07 11:59:00
收藏:0
阅读:609
1、简单赋值
<div ref="refCon"></div>
访问方式:
this.$refs.refCon
2、循环赋值,相同名称
<div v-for="i in 2" ref="refCon"></div>
访问方式:
this.$refs.refCon[0]
this.$refs.refCon[1]
3、循环赋值,不同名称
<div v-for="i in 2" :ref="`refCon${i}`"></div>
访问方式:
this.$refs.refCon0[0]
this.$refs.refCon1[0]
原文:https://www.cnblogs.com/frost-yen/p/11145791.html
评论(0)