Vue ref
Vue ref
用于获取组件实例
<template>
<div id="app">
<HelloWorld ref="ref1" />
<h1 @click="show">点我输出ref</h1>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
},
methods:{
show(){
console.log(this.$refs);
}
}
}
</script>