vue.js computed使用
================================
©Copyright 蕃薯耀 2018年12月03日
http://fanshuyao.iteye.com/
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>vue 计算</title>
</head>
<body>
<div id="vue-div">
<div>姓:<input placeholder="姓" v-model="firstName"/></div>
<div>名:<input placeholder="名" v-model="lastName"/></div>
<div>全名:<input placeholder="全名" v-model="getFullName"/></div>
</div>
<script type="text/javascript" src="../js/vue.min.js"></script>
<script type="text/javascript">
var vueObj = new Vue({
el: "#vue-div",
data: {
firstName : "张",
lastName : "三"
},
computed:{
getFullName(){
return this.firstName + "," + this.lastName;
}
}
});
</script>
</body>
</html>
================================
©Copyright 蕃薯耀 2018年12月03日
http://fanshuyao.iteye.com/