babel-plugin-transform-vue-jsx icon indicating copy to clipboard operation
babel-plugin-transform-vue-jsx copied to clipboard

How to use the filter?

Open gooqiao opened this issue 7 years ago • 2 comments

<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?

gooqiao avatar Sep 25 '18 06:09 gooqiao

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>

Shinigami92 avatar Jun 17 '19 09:06 Shinigami92

this.$options.filters.customDateFilter('2016-05-03)

guohuihot avatar Jun 09 '20 02:06 guohuihot