自訂過濾器
<html>
<head>
<meta charset="UTF-8">
<title>自訂過濾器</title>
</head>
<body>
<div id="show">
<input v-model="money">
{{ money | money }}
</div>
</body>
<script src="vue.js"></script>
<script>
/**
* add filter
*/
Vue.filter('money', function (value) {
return '$' + value;
});
new Vue({
el: '#show',
data: {
money: 100000
}
});
</script>
</html>