my.navigateBack.
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
| url | String | Yes | Page path with optional query parameters (format: path?key=value&key2=value2) |
| success | Function | No | Callback on success |
| fail | Function | No | Callback on failure |
| complete | Function | No | Callback that always executes |
Code Example
Basic Navigation
With Query Parameters
Receiving Parameters
With Callbacks
Use Cases
Navigate to Detail Page
Navigate to Detail Page
Conditional Navigation
Conditional Navigation
Important Notes
- Cannot navigate to tab bar pages (use
my.switchTabinstead) - Query parameter values should be URL-encoded if they contain special characters
- The current page is preserved and can be returned to with
my.navigateBack
Differences from Other Navigation APIs
| API | Behavior |
|---|---|
my.navigateTo | Opens new page, keeps current page in stack |
my.redirectTo | Replaces current page (cannot go back) |
my.reLaunch | Closes all pages, opens target page |
my.switchTab | Navigates to tab page only |
Related APIs
my.navigateBack
Go back to previous page
my.redirectTo
Replace current page