Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can i use multiple Vue Composable functions in one file? how do I structure it?

Can i use multiple vue composables in one file?
example:

<script>
export function arrayToInt(arr) {
...
}

export function arrayToUint(arr) {
...
}
</script>

then somewhere else:

import {arrayToInt, arrayToUint} from "./useBytesHelper"

because im getting a vue router parsing error right at the beggining when loading my app. and i might be doing this wrong

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Considering that the file is JavaScript module (useBytesHelper.js) and not Vue SFC (useBytesHelper.vue), it’s incorrect to use <script> tag there.

The rest is correct, it should be used as listed:

import {arrayToInt, arrayToUint} from "./useBytesHelper"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading