Vue Router integration for @ionic/vue with Ionic-specific navigation features
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Programmatic navigation APIs with Ionic-specific features like animations, directions, and tab handling. These methods are available through the injected navManager provider in Vue components.
import { inject } from 'vue';
export default {
setup() {
const navManager = inject('navManager');
// Use navigation methods...
}
}Navigate to a specific route with Ionic-specific parameters.
/**
* Navigate to a specific route with Ionic-specific parameters
* @param path - Route path or location to navigate to
* @param routerAction - Type of navigation action (default: "push")
* @param routerDirection - Animation direction for navigation (default: "forward")
* @param routerAnimation - Custom animation builder for transitions
* @param tab - Tab context for the navigation
*/
handleNavigate(
path: RouteLocationRaw,
routerAction?: RouteAction,
routerDirection?: RouteDirection,
routerAnimation?: AnimationBuilder,
tab?: string
): void;Usage Examples:
// Basic navigation
navManager.handleNavigate('/profile');
// Navigation with direction and animation
navManager.handleNavigate('/settings', 'push', 'forward');
// Replace current route
navManager.handleNavigate('/login', 'replace', 'root');
// Tab-aware navigation
navManager.handleNavigate('/tabs/discover', 'push', 'forward', undefined, 'discover');Handle backward navigation with support for default fallback routes.
/**
* Handle backward navigation with optional fallback route
* @param defaultHref - Fallback route if no back history exists
* @param routerAnimation - Custom animation for back navigation
*/
handleNavigateBack(defaultHref?: string, routerAnimation?: AnimationBuilder): void;Usage Examples:
// Simple back navigation
navManager.handleNavigateBack();
// Back navigation with fallback
navManager.handleNavigateBack('/home');
// Back navigation with custom animation
navManager.handleNavigateBack('/home', customSlideAnimation);Navigate using external navigation options object.
/**
* Navigate using external navigation options
* @param navigationOptions - Object containing navigation parameters
*/
navigate(navigationOptions: ExternalNavigationOptions): void;
interface ExternalNavigationOptions {
routerLink: string;
routerDirection?: RouteDirection;
routerAnimation?: AnimationBuilder;
routerAction?: RouteAction;
}Usage Example:
navManager.navigate({
routerLink: '/profile',
routerDirection: 'forward',
routerAction: 'push'
});Retrieve information about the current route including navigation context.
/**
* Get current route information with navigation context
* @returns Current route information object
*/
getCurrentRouteInfo(): RouteInfo;Get information about the route being left during navigation.
/**
* Get information about the route being left during navigation
* @returns Route information for the leaving route
*/
getLeavingRouteInfo(): RouteInfo;Determine if backward navigation is possible.
/**
* Check if backward navigation is possible
* @param deep - Number of steps to check back (default: 1)
* @returns True if back navigation is possible
*/
canGoBack(deep?: number): boolean;Usage Examples:
// Check if can go back one step
if (navManager.canGoBack()) {
navManager.handleNavigateBack();
}
// Check if can go back multiple steps
if (navManager.canGoBack(3)) {
// Can go back 3 steps
}Navigate using browser history with Ionic animations.
/**
* Navigate backward in browser history with optional animation
* @param routerAnimation - Custom animation for back navigation
*/
goBack(routerAnimation?: AnimationBuilder): void;
/**
* Navigate forward in browser history with optional animation
* @param routerAnimation - Custom animation for forward navigation
*/
goForward(routerAnimation?: AnimationBuilder): void;Usage Examples:
// Basic browser back
navManager.goBack();
// Browser back with custom animation
navManager.goBack(customSlideAnimation);
// Browser forward
navManager.goForward();Manage tab-based navigation including tab switching and resetting.
/**
* Reset a tab to its initial route
* @param tab - Tab identifier to reset
*/
resetTab(tab: string): void;
/**
* Change to a different tab with optional specific path
* @param tab - Tab identifier to switch to
* @param path - Optional specific path within the tab
*/
changeTab(tab: string, path?: string): void;
/**
* Set the current tab context for route information
* @param tab - Tab identifier to set as current
*/
handleSetCurrentTab(tab: string): void;Usage Examples:
// Reset tab to initial route
navManager.resetTab('discover');
// Switch to tab at specific path
navManager.changeTab('profile', '/tabs/profile/settings');
// Set current tab context
navManager.handleSetCurrentTab('home');Register a callback to listen for navigation history changes.
/**
* Register a callback for history change events
* @param callback - Function to call when history changes
*/
registerHistoryChangeListener(callback: (routeInfo: RouteInfo) => void): void;Usage Example:
navManager.registerHistoryChangeListener((routeInfo) => {
console.log('Navigation changed:', routeInfo.pathname);
});