1👍
Something like this:
lib/api.js
const loadStuff = async (params) => {...};
export { loadStuff };
components/widget.vue
import { loadStuff } from '~/lib/api';
Note that the ~/lib/api
path will vary depending on the file name and your build environment. E.g. it could be @/lib/api
.
- [Vuejs]-How to show HTML from this array Vue JS
- [Vuejs]-Visual Studio Code: Cannot find module – app.vue
Source:stackexchange.com