console
<!DOCTYPE html>
<html lang="en">
<head>
<title>computed option</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
<h1>computed option</h1>
<hr>
<div id="app">
{{newPrice}}
</div>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
price:100
},
computed: {
newPrice:function(){
return "¥"+this.price+"元";
}
},
})
</script>
</body>
</html>