[uni-app] errMsg : navigateTo:fail can not navigateTo a tabbar page error report solution


foreword

Hello everyone, when I was developing the uni-app project today, an error was reported when the page was redirected. At first, I thought it was just a small error report, so I didn’t read the error report carefully. I went directly to the page to check whether it was a jump or not. I wrote it well, but after checking it, I found that there was no problem, so I thought that there was no routing configured, but after checking everything, I found that there was no problem, so I went to see the error report, and after reading the error report, I found the problem. Let’s take a look at this Report errors and solutions.

1. Error reporting

insert image description here
The error message is also simple and clear. The translation is: "errMsg": "Navigate to: Failed to navigate to the tab page." This means that
navigateTO failed to jump to the page because navigateTO cannot jump to the tab page.

Two, the solution

change api

The code is as follows (example):

uni.switchTab({
    
    
			url: '../dianpu/index'
		});

navigateTo: Keep the current page, jump to a page in the application, use uni.navigateBack to return to the original page.
switchTab: Jump to the tabBar page and close all other non-tabBar pages.
Since this part of the jump page was taken together with other things, and the tab page was not noticed, an error was reported without any changes.


Summarize

When an error occurs, you must first check what the error is, and do not make changes blindly. This will lead to errors and errors. You must also be careful when developing projects to improve development efficiency.
When project development encounters an error report, the following steps can be used to troubleshoot:

  1. Carefully review the error message to determine the type and location of the error.
  2. Check whether the relevant source code is correct, whether there are grammatical errors, typos or code logic problems.
  3. Check for issues with third-party libraries or plugins used and troubleshoot errors caused by them.
  4. Check whether the environment configuration is correct, such as database connection, server configuration, etc.
  5. Run the debugging tool or print logs to troubleshoot and locate specific errors.
  6. Find solutions to related problems in search engines or community forums.
    If the steps above do not resolve the issue, consider seeking professional support or other peer experience.
    The above is the whole content of this chapter, I hope it can help you.

Guess you like

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