babel-plugin-transform-vue-jsx
babel-plugin-transform-vue-jsx copied to clipboard
How to use the filter?
<div >
{'2016-05-03' | customDateFilter("YYYY-MM-DD")}
</div>
customDateFilter is a filter,When I do, he does not work.
Is there any other way?
The only way I know is to rewrite it to something like this:
import customDateFilter from './customDateFilter'
// ...
<div >
{ customDateFilter('2016-05-03', 'YYYY-MM-DD') }
</div>
or with moment.js
import moment from 'moment'
// ...
const date // maybe can be undefined?!
<div >
{ date ? moment(date).format('YYYY-MM-DD') : '' }
</div>
this.$options.filters.customDateFilter('2016-05-03)