在Vue中,mustache语法不仅可以直接写变量,还支持简单的表达式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app">
<!-- mustache语法不仅可以直接写变量,而且可以写简单的表达式 -->
<h2>{{message}}</h2>
<h2>{{message}}——大壮</h2>
<h2>{{firstName + lastName}}</h2>
<h2>{{firstName + ' ' +lastName}}</h2>
<h2>{{firstName}} {{lastName}}</h2>
<h2>{{counter * 2}}</h2>
</div>
<script src="../../js/vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
message: '伪装',
firstName: 'kobe',
lastName: 'bryant',
counter: 100
}
});
</script>
</body>
</html>