How to reference a global function in a Vue component?
you may want to export the function from some other file, this is simply a case of declaring it the way you want.
in some other file...
// utils.jsexport function createOptions (someArg) { let options = [ ... ] return options}
in your .vue file
<script> import { createOptions } from './utils' export default { ... data () { return { options: createOptions() } } }</script>
You may also want to try snovakovic's advice to externalise the dropdown component instead, whatever brings you more flexibility
Why not just create states components that handles drop-down and then include that component everywhere where it's used.
If you want just a function then create js file that expose that function and than import that file inside component.