请陛下批阅
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>computed的使用</title>
<script src="../../vue/vue-v2.6.11.js"></script>
</head>
<body>
<div id="app">
<input type="text" v-model="firstName"> +
<input type="text" v-model="lastName"> =
<input type="text" v-model="fullName">
<p>{{ fullName }}</p>
<p>{{ fullName }}</p>
<p>{{ fullName }}</p>
</div>
</body>
<script>
var vm = new Vue({
el: '#app',
data: {
firstName: '',
lastName: ''
},
computed: {
'fullName': function () {
console.log('jhh');
return this.firstName + '-' + this.lastName;
}
}
});
</script>
</html>