为什么还是{{fullname}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Vue中的计算属性和侦听器</title>
<script src="./vue.min.js"></script>
</head>
<body>
<div id="root2">
姓:<input v-model="firstname"/>
名<input v-model="lastname"/>
<div>{{fullname}}</div>
</div>
<script>
new vue({
el:"#root2",
data: {
firstname:'',
lastname:''
},
computed: {
fullname: function() {
return this.firstname + this.lastname
}
}
})
</script>
</body>
</html>