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

29 lines
707 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>数据绑定</title>
<script type="text/javascript" src="../vue.js"></script>
</head>
<body>
<div id="root">
<!--完整写法-->
单向数据绑定:<input type="text" v-bind:value="name"><br>
双向数据绑定:<input type="text" v-model:value="name">
<hr>
<!--简略写法-->
单向数据绑定:<input type="text" :value="name"><br>
双向数据绑定:<input type="text" v-model:name="name">
</div>
<script type="text/javascript">
Vue.config.productionTip = false
new Vue({
el: '#root',
data: {
name: 'Roger'
}
})
</script>
</body>
</html>