Solution: this.$refs refers to subcomponents and reports an error is not a function

Solution: this.$refs refers to subcomponents and reports an error is not a function

  • Description of the problem:
    Vue refers to subcomponents through this.$refs, and there is an error of undefined or is not a function

  • The error is as follows:
    _this3.$refs.fileUpload.changeFileList is not a function


problem analysis:

  • Problem 1: An undefined error occurs

    1. The tag containing the sub-component needs to be placed in the sub-tag of the first sub-tag, and the ref attribute needs to be set,

      Because the logic code of the parent component calls the method or property of the child component through this property.

  • Question 2: There is an error of is not a function

    1. Subcomponents need to be imported, please make sure the path is correct when importing
    2. After import, you need to register in the component of the parent component

Solution:

  • According to the above analysis, the seat number can be modified.

end.

Guess you like

Origin blog.csdn.net/qq_35393869/article/details/127810529