[Vuejs]-How do I validate v-forms within a v-data-table on page load?

1👍

Here’s how I ended up solving it. I moved the <v-form> outside of the <v-data-table> and added a two-second delay to calling the validate() function.

Code

Template

<v-card max-width="95%">
    <v-card-title>Collateral</v-card-title>
    <v-form ref="collateral_form">
        <v-data-table
          :items="this.$store.state.CurrentInstrumentDetails.collateral"
          :headers="headers"
        >
          .
          .
          .
        </v-data-table>
    </v-form>
</v-card>

Typescript

mounted() {
  setTimeout(() => {
    (this.$refs.collateral_form as any).validate();
  }, 2000); 
}

Leave a comment