Appearance
useNavigationContext ​
Definition ​
Composable to get navigation context from the URL.
Basic usage ​
ts
const {
navigationContext,
routeName,
foreignKey
} = useNavigationContext(context);
Signature ​
ts
export function useNavigationContext(
context?: Ref<Schemas["SeoUrl"] | null>,
): UseNavigationContextReturn
Parameters ​
Name | Type | Description |
---|---|---|
context | Ref< | null> |
Return type ​
See UseNavigationContextReturn
ts
export type UseNavigationContextReturn = {
/**
* SEO URL from the navigation context
*/
navigationContext: ComputedRef<Schemas["SeoUrl"] | null>;
/**
* Route name from the navigation context
*/
routeName: ComputedRef<Schemas["SeoUrl"]["routeName"] | undefined>;
/**
* Foreign key (ID) for current navigation context
*/
foreignKey: ComputedRef<string>;
};
Properties ​
Name | Type | Description |
---|---|---|
navigationContext | ComputedRef< | null> | SEO URL from the navigation context |
routeName | ComputedRef< | undefined> | Route name from the navigation context |
foreignKey | ComputedRef<string> | Foreign key (ID) for current navigation context |
Usage ​
ts
import { useNavigationContext } from "@shopware-pwa/composables-next";
const { product } = useNavigationContext();