V-validate on dynamic custom component V-validate on dynamic custom component vue.js vue.js

V-validate on dynamic custom component


You need to use v-bind to pass any data to the component instead of v-model. Another way to do is, you can create one generic component, say BaseInput which takes yours input current object as props. Inside your BaseInput component you can select your Integer or String component using v-if, like this.

<template v-if="inputCurrentObject.type === 'string' ">  <Integer :input="inputCurrentObject.value" /></template>

Inside your BaseInput you can render the components based on the input type.