a problem about props key of Paser components
andyqier88 opened this issue · comments
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"
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" />
As shown in the following example, the key property is bound to a variable
key2
. Update thekey2
variable whenever the form needs to be refreshed.<parser :key="key2" :form-conf="formConf" @submit="sumbitForm2" />
copy that