value:sync
form-create by value.snyc implementation v-model function
value.snyc
v-model
<template> <div> <p>formData: {{value}}</p> <form-create :rule="rule" v-model="fApi" :option="options" :value.sync="value"/> </div> </template> <script> export default { data(){ return { fApi:{}, value:{field1:'111',field2:'222',time:'11:11:11'}, options:{ onSubmit:(formData)=>{ alert(JSON.stringify(formData)) } }, rule:[ {type:'input', field:'field1',title:'field1',value:'aaa'}, {type:'input', field:'field2',title:'field2',value:'sss'}, {type:'timePicker', field:'time',title:'time',value:'12:12:12'}, { type:'ElButton', title:'Modify field1', native: false, on:{ click: ()=>{ this.rule[0].value+='a' } }, children: ['click'], } ] } } } </script>
← Custom attribute Other configuration →