console
Yox.filter({
formatDate: function (value) {
var month = value.getMonth() + 1
var date = value.getDate()
return [
value.getFullYear(),
month < 10 ? '0' + month : month,
date < 10 ? '0' + date : date
].join('-')
},
formatContent: function (value) {
return value.replace(/yox/g, '<em>yox</em>')
}
})
new Yox({
el: '#app',
template: '#template',
data: {
birthday: new Date(),
content: 'yox is a good boy'
}
})
<div id="app"></div>
<script id="template" type="text/plain">
<div>
<p>
{{ birthday }}
</p>
<p>
{{ formatDate(birthday) }}
</p>
<p>
{{{ formatContent(content) }}}
</p>
</div>
</script>
em {
color: red;
}