computed-计算属性的使用和3个特点 方案3

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../vue.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"/>
</div>
</body>
<script>
new Vue({
el: "#app",
data: {
mes: "hello Vue",
firstname: "",
lastname: ""

},
computed:{
"fullname":function () {
return this.firstname+"---"+this.lastname
}
}
});
</script>
</html>


  

猜你喜欢

转载自www.cnblogs.com/jiahaoJAVA/p/9484654.html