admin-vue/09-v-model双向绑定属性使用/不使用v-model实现双向绑定.html

35 lines
683 B
HTML
Raw Normal View History

2022-10-15 10:05:34 +08:00
<!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>
<div id="app">
<input type="text" name="" id="" :value="message" @input="ChangeMessage($event)">
<br> data中的数据:{{message}}
</div>
</body>
<script src="../JavaScript/vue.min.js"></script>
<script>
const vue = new Vue({
el: "#app",
data: {
message: "你好呀"
},
methods: {
ChangeMessage(event){
this.message=event.target.value
}
},
computed: {
}
})
</script>
</html>