I am getting this error in Vue.js:
vue.esm.js?efeb:628 [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'v4'
of undefined"
found in
---> <AddTodo> at src/components/AddTodo.vue
<App> at src/App.vue
<Root>
I have already installed uuid, so v4 should be working, but it is not.
I am getting this error in Vue.js:
vue.esm.js?efeb:628 [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'v4'
of undefined"
found in
---> <AddTodo> at src/components/AddTodo.vue
<App> at src/App.vue
<Root>
I have already installed uuid, so v4 should be working, but it is not.
Share Improve this question edited Sep 6, 2023 at 20:20 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Aug 11, 2020 at 12:43 BonaventureBonaventure 711 silver badge7 bronze badges 02 Answers
Reset to default 23I got the same error and I solved it.
import {v4} from 'uuid';
const uuId = v4()
Use:
import * as uuid from 'uuid';
Now you can call anything from uuid. Such as,
uuid.v4();