https://forum.vuejs.org/t/putting-a-method-axios-inside-a-global-component/21729/2 axiosGet.jsexport function axiosGet (url) { return axios.get(url) .then(function (response) { return response.data.data; }) .catch(function (error) { return 'An error occured..' + error; }) } somehtml.html//... import { axiosGet } from './axiosGet'; // Filename would be axiosGet.js, you don't need the js extension..