1 var app = new Vue({
2 el:'#app',
3 methods: {
4 showMyDiv() {
5 console.log(this.$refs.myDiv);
6 }
7 }
8
9 });
10<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
11<div id='app'>
12 <div id="myDiv" ref="myDiv"></div>
13 <button v-on:click="showMyDiv" >Show My Div</button>
14</div>