ResetFields () using iview Form reports an error under F12

clipboard.png
vue+typescript


clipboard.png
if the page form I edited has data, it doesn"t seem to report an error. When the form has no data, it is the most likely to report an error.
its indexOf of undefined, seems to say that if my prop is of numerical type, there is no indexOf, but I changed the prop to string type, and it still reported an error

.

this bug sometimes has, sometimes it doesn"t, it"s a little strange, help~

Mar.21,2021

is there someone in your FormItem that uses v-if when you first resetFields, and the next time you resetFileds, if = "false", that is, if the props bound to this FormItem cannot be found, this error will be reported, and there will be no problem if you change it to v-show


.
  1. use this.$refs instead of this.$ref
  2. with this.$nextTick (() = > {})
  3. model / ref in el-form and prop in el-form-item check it again
< hr >

10:55:49 on June 30, 2020


what I'm talking about below is pure speculation.
you say it's easy to make a mistake,
1. It should be caused when you jump to the page, because the jump is already on another page, and executing this method on another page may cause an error.
2. There is something wrong with your path data type. You can convert your path to string before you judge it here, and then try

.

because there is no code for specific symptoms, it is pure speculation.


generally speaking, the reason for such an error as cannot read property "" of undefined
is to try to call undefined.indexOf ()
look at your code, that is, path this variable is undefined, that is, this.prop is undefined.
to see if there is a problem with the assignment process of this.prop .

finally, you say that bug is occasional. Is this.prop assigned in asynchronous calls? check this process to see if you can really locate the problem.

Menu