Vue cli ref属性
1、被用来给元素或子组件引入信息
2、元素获取真实DOM,子组件获取子组件的 组件实例化对象 VueComponents
3、使用方法
打标识 ref='"名字"
<div> <h2 ref="title">{{info}}</h2> <button ref="btn" @click="showInfo">点击获取上面的html</button> <SchoolData ref="sd"/> </div>
获取
this.$refs.title this.$refs
1、被用来给元素或子组件引入信息
2、元素获取真实DOM,子组件获取子组件的 组件实例化对象 VueComponents
3、使用方法
打标识 ref='"名字"
<div> <h2 ref="title">{{info}}</h2> <button ref="btn" @click="showInfo">点击获取上面的html</button> <SchoolData ref="sd"/> </div>
获取
this.$refs.title this.$refs