A
A
Alianos2021-05-03 11:51:55
Vue.js
Alianos, 2021-05-03 11:51:55

How to make Vue-directive/Vue-filter available in all components?

Hello, please tell me how to make the directive / filter available in all components of the vue cli project. Also how can I make them available only on all components of a particular page...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava191, 2021-05-03
@Slava191

When you register a filter in src/main.js like this

import filter from '@/filters/filter'
Vue.filter('filter', filter);

the filter becomes available in all components of the project

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question