DEV Community

Discussion on: Interview Questions for Vue

Collapse
 
rehmatfalcon profile image
Kushal Niroula

It's worth noting that Filters have been removed in Vue 3.

It is advised to use a regular method call or computed property to achieve its task.

Your example would then become,

{
...,
computed: {
    capitalizedValue: function() {
      if (!this.value) return '';
      return this.value.charAt(0).toUpperCase() + this.value.slice(1);
    }
  },
methods: {
    capitalize: function(value) {
      if (!value) return '';
      value = value.toString()
      return value.charAt(0).toUpperCase() + value.slice(1)
    }
}
...
Enter fullscreen mode Exit fullscreen mode
<div>
{{ capitalizedValue }}

{{ capitalize(value) }}
</div>
Enter fullscreen mode Exit fullscreen mode

Read more about it and the migration strategy here v3.vuejs.org/guide/migration/filte...

Collapse
 
adnanbabakan profile image
Adnan Babakan (he/him)

Thanks for reading my article. Yes, I am aware of this change but Vue 3 isn't officially out yet and the current official version is 2. So I omitted Vue 3 related things.