<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style>
</style>
<body>
<div id="app">
<!-- 双花括号插值 -->
{{totalMoney|formatMoney}}
</div>
</body>
<script src="vue2.js"></script>
<script>
var app=new Vue({
el:"#app",
data:
{
totalMoney:12
},
filters:
{
formatMoney:function(value)
{
return "$"+value.toFixed(2);
}
}
})
</script>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style>
</style>
<body>
<div id="app">
<!-- 双花括号插值 -->
{{totalMoney|formatMoney}}
</div>
</body>
<script src="vue2.js"></script>
<script>
var app=new Vue({
el:"#app",
data:
{
totalMoney:12
},
filters:
{
formatMoney:function(value)
{
return "$"+value.toFixed(2);
}
}
})
</script>
</html>