H
H
HitGirl2021-06-08 15:43:15
Vue.js
HitGirl, 2021-06-08 15:43:15

How to include vuelidate in vue3?

Hello!
Tell me how to connect this plugin, there is no Vue variable in the main.js file?

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')

import Vuelidate from 'vuelidate'
Vue.use(Vuelidate)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lavezzi1, 2021-06-08
@lavezzi1

Vuelidate v2 doesn't need to be globally included in main.js as it was in the previous vue 2 version . Now we need to use the useVuelidate() hook in the component's setup. Read more here https://vuelidate-next.netlify.app/

D
Dmitry Kuznetsov, 2021-06-08
@dima9595

I would try to write it like this:

import { createApp } from 'vue'
import App from './App.vue'
import Vuelidate from 'vuelidate'

const app = createApp(App)
app.use(Vuelidate)
app.mount('#app')

UPD: And in general, judging by the documentation, Vuelidate only works with Vue 2, not Vue 3.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question