<template>
<div class="hello">
<h1>{{msg}}</h1>
<div id="test" ref="div1">
<input type="text" ref="input1" name="name" />
<button @click="add"> 增加 </button>
</div>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {msg: 'Welcome to Your Vue.js App'}
},
methods:{add(){
// this.$refs.input1.value = '22';
let input1 = this.$refs.input1;
let div1 = this.$refs.div1;
console.log(input1,div1);
}
}
}