<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="qwe">
<p>{{message}}</p>
<p v-text="message"></p>
<input type="text" v-model="message" @keyup.enter="showMessage(message)">
</div>
<!-- 获取和设置表单元素的值(双向数据绑定) -->
<script>
var qwe = new Vue({
el:'#qwe',
data:{
message:"哈哈哈",
},
methods: {
showMessage(p1){
alert(p1);
}
},
})
</script>
</body>
</html>