# 表单双向绑定 value:sync
v2.5.0+
form-create 是通过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:'修改 field1',
native: false,
on:{
click: ()=>{
this.rule[0].value+='a'
}
},
children: ['点击'],
}
]
}
}
}
</script>