[Vuejs]-How to apply a vue.js filter by it's 'name'

2πŸ‘

βœ…

In your example, you would need to set col.format to be the actual function, not the name of the function:

let date_format = Vue.filter('date_format');
let money_format = Vue.filter('money_format');

let cols = [
  { field: 'dt_joined', format: date_format },
  { field: 'dt_trained', format: date_format },
  { field: 'salary', format: money_format }
]

Then foo | col.format will apply the function being pointed at by col.format to the foo variable before rendering it.

πŸ‘€thanksd

Leave a comment