S
S
survivor20052021-12-02 22:37:53
Vue.js
survivor2005, 2021-12-02 22:37:53

How to call a function from another file in vue?

All the best, I have functions that may be needed in many components. How can I do it right so that it would be possible to call functions from any component that are described somewhere once. For example from another component. There is an option to use provide, but somehow it seemed to me not good to throw a bunch of functions on the root component in order to make the functions available globally. How to do it more correctly? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Chipekwe, 2021-12-03
@survivor2005

https://ru.vuejs.org/v2/guide/mixins.html

W
WapSter, 2021-12-02
@wapster92

Well, export it and import it into the desired component

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question