S
S
sergeyviktorovich2021-02-11 22:31:16
Vue.js
sergeyviktorovich, 2021-02-11 22:31:16

How to connect vuelidate via cdn?

connected like this, but it doesn't work

index.html?name=&email=&tel=&lenguage=:39 Uncaught TypeError: Cannot destructure property 'required' of 'window.validators' as it is undefined.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
  <script src="https://bundle.run/[email protected]"></script>
  <script>
const { required, minLength } = window.validators; /*:class="{invalid:($v.name.$dirty && !$v.name.required)}*/

new Vue({
  el: "#app",
    data: {
        name: '',
        email: '',
        tel: '',
        lenguages:['en','ru','ua'],
        lenguage:""

  },
 validations: {
    name: {
     required,
      minLength: minLength(5)
    },
    email: {
        email,
      required,
 
    },
    tel: {
     required,
      minLength: minLength(5)
    },
   
    
  },
  methods: {
  	submitHandler() {
    if(this.$v.$invalid){
        this.$v.$tach();
    }
    }
  }
})
  </script>


поделючил так   <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/index.min.js"></script>
ошибка
index.js:3 Uncaught ReferenceError: exports is not defined
 Uncaught ReferenceError: required is not defined

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Pastukhov, 2021-02-12
@sergeyviktorovich

Judging by the dock , you need

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuelidate.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/validators.min.js"></script>

A
Anatoly, 2017-09-15
@trofimovdev

Is it that hard to read the documentation ?
IMHO it is better not to suffer such garbage, but to do something useful.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question