语法
computed:{
	key(属性名):function(){
	}
}
实例
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        [v-cloak]{
            display: none;
        }
    </style>
</head>
<body>


<div id="app" v-cloak>
<h2>姓名:{{fullName}}</h2>
</div>
<script src="../js/vue.js"></script>
<script>

    const app=new Vue({
        el:"#app",
        data:{
            firstName:"张",
            lastName:'三'
        },
        computed:{
            fullName:function(){
                return this.firstName+" "+this.lastName;
            }
        }
    });

</script>

</body>
</html>
效果

VueJs 计算属性_Vue