ref类似于id,用于给元素或者子组件注册引用信息
父组件通过$refs这个对象引用ref所注册的元素或者子组件
ref在普通元素时,refs指向组件实例
<h3 id="buluohe"> hello,任憨憨</h3>
console.log(document.getElementById("buluohe").innerHTML);
<h3 ref="buluohe"> hello,任憨憨</h3>
console.log(this.$refs.buluohe.innerHTML);
子组件使用ref时,父组件的实例下会加载子组件内的所有方法和属性,可以直接调用
this.$refs.myLogin.show()
console.log(this.$refs.myLogin.msg);