小编Hal*_*ios的帖子

验证子组件Vue vee-validate

应用程式(父母)

嗨,我有这些组件(子组件)TextComponent InfoErrorForm

当我按下从父组件提交的应用程序时,不会验证此表单。因此,我尝试在子组件(TextComponent)中注入$ validator进行验证,并提供但不显示message error。如果可以帮助我验证inisde父组件的子代,则可以。这是我的代码

AppComponent

<template>
      <div>
        <!-- Form validar numero max input -->
        <form :class="{'was-validated': error_in_form_save_progress}" >

           <card-shadow v-for="(texto,key) in sections_template.texts" :key="key" > 
            <texto-component 
              :orden="key+2"
              v-model="sections_template.texts[key].content" 
              :tituloComponente="texto.title" 
              :inputName="texto.title" >
              <template slot="section_show_error_validate_input">
                <info-error-form 
                  :listErrors='errors' 
                  :name_field = "texto.title" 
                  v-show = "error_in_form_save_progress" >
                </info-error-form>
              </template>
            </texto-component>
          </card-shadow>

        </form>

        <div class="row foot_button" >
          <div class="offset-md-3 col-md-3">
            <button class="btn" @click.prevent="save_progrees"> Guardar Cambios</button>
          </div>

        </div>
      </div>
    </template>

    <script>

      export default {

        provide() {
       return {
         $validator: this.$validator,
       };
    },
        data: function(){
          return { …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-component vuejs2 vee-validate

5
推荐指数
1
解决办法
4734
查看次数

标签 统计

vee-validate ×1

vue-component ×1

vue.js ×1

vuejs2 ×1