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

Time:07-11

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

CodePudding user response:

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"
  • Related