组件上使用ref
<my-component ref='myCompenent'/>
this.$refs["myCompenent"]
获取到的是vue实例 拥有$el属性
this.$refs["myCompenent"].$el
获取到的是myCompenent组件的dom结构
普通标签使用ref
<div ref='myLabel'></div>
this.$refs["myLabel"]
获取到的是该标签的dom结构
this.$refs["myLabel"].$el
获取到的是undefined
![在这里插入图片描述](https://img-blog.csdnimg.cn/0b1a4d0b03fc4394909b40521ad57079.png#pic_center)