JakHuang / form-generator

:sparkles:Element UI表单设计及代码生成器
https://jakhuang.github.io/form-generator
MIT License
8.91k stars 2.16k forks source link

a problem about props key of Paser components #156

Closed andyqier88 closed 2 years ago

andyqier88 commented 2 years ago

when we write this code in template like this

<parser :key="new Date().getTime()" :form-conf="formConf" @submit="sumbitForm1" />
<parser :key="key2" :form-conf="formConf" @submit="sumbitForm2" />
<el-input v-model="test" />

the key of parser is dynamic like new Date().getTime() ,when we change another input v-model="test" the values of the form in parser will be cleared

we can solve it by setting a settled value like :key="2022"

JakHuang commented 2 years ago

As shown in the following example, the key property is bound to a variable key2. Update the key2 variable whenever the form needs to be refreshed. <parser :key="key2" :form-conf="formConf" @submit="sumbitForm2" />

andyqier88 commented 2 years ago

As shown in the following example, the key property is bound to a variable key2. Update the key2 variable whenever the form needs to be refreshed. <parser :key="key2" :form-conf="formConf" @submit="sumbitForm2" />

copy that