You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
691 B
Vue

3 years ago
<template>
<div>
<h1>{{title}}</h1>
<input ref="input" v-model="input" type="text">
<button @click="getVaule"></button>
<div class="tip">请F12打开console控制查看结果</div>
</div>
</template>
<script>
export default {
name:'GetValue',
data(){
return{
title:'这是GetValue组件',
input:'绑定的值',
}
},
methods:{
getVaule(){
console.log('这是ref获取的值'+this.$refs.input.value)
console.log('通过this去定义好的值'+this.input)
}
}
}
</script>
<style>
.tip{
background: red;
color: #fff;
margin-top: 10px;
}
</style>