[uni-app] using external components does not display an error component not found a solution


foreword

Hello everyone, today I would like to share with you a solution for using external components in uni-app without displaying errors, hoping to help everyone.

1. Problem description

When I was using uni-app to develop a project, I introduced an external component library. It was normal when I first introduced it, but as the development progressed, I suddenly found that the components used by several pages did not work during a test. , and the console also started reporting errors.
insert image description here
When this error occurred, I also started to look for a solution, but I couldn't find it. When I checked the code, I found that the terminal also reported several errors.
insert image description here
It can be seen that line 23 was drawn out, and later it was found that the format was wrong. The src of my image was wrapped in quotation marks and two curly braces. Although the image can be displayed in this way, it is not a correct format, so I Just change it to the correct format. insert image description here
In uni-app, you don’t need to use curly braces to wrap it, but you need to add a colon in front of src. When I change it to the correct one, the error will disappear. When I view the page It is found that the external components used by this page are displayed, and the error report that was not found is gone.
Generally, this kind of error is because your format is incorrect, and there is another page error like this.
insert image description here
If this error is reported, I will tell you directly that there is an error in your project, where there is a problem, and I will tell you the solution very intimately. If this error is reported, the translation is to let you change the format of your error to Correct, this error is the same as the picture above, just remove the curly braces and use colons for binding.
After the modification, there is no error report, and the components used in the current page are also normal.

2. Tips

When in project development or other, when an error occurs, it must be resolved immediately. Although sometimes an error is reported, it can still be used, so don’t take chances. If an error occurs, it must be resolved immediately, otherwise it will only add to the error. , It becomes more and more chaotic, and when there are more errors, it becomes complicated and difficult to solve.

Summarize

Errors refer to some unexpected errors or abnormal conditions that occur during the execution of a program or system, resulting in the failure of the program to execute normally or to produce erroneous results. A solution is an action taken when an error is encountered, either to fix the error or to enable the program to function properly.
The relationship between solutions and errors is that solutions are created to address errors. When an error occurs, we need to identify and analyze why the error occurred, and then provide some solutions that can solve the problem or fix the error. In this process, the solution will serve as a tool or method to implement the bug fix. Therefore, errors and solutions are related, and the existence of errors drives us to seek solutions to solve them.
The above is the whole content of this chapter, thank you for reading, hope to help you.

Guess you like

Origin blog.csdn.net/SqlloveSyn/article/details/130944316