[Vuejs]-Can shift a component's function in some other file in vue?

0👍

No you cant but you can use mixins. You can also store it in a js file and export it.

export yourFunction() {

}

export anotherFunction(){
}

And import it in your file

import {yourFunction, anotherFunction} from 'path/to/your_file';

methods: {
  callSomeFunction() {
    // you can call it like this.
    yourFunction();
  }
}

Leave a comment