The following is the definition of the router object returned by both useRouter and withRouter:
pathname:
String - Current route. That is the path of the page in /pages, the configured basePath or locale is not included.
query:
Object - The query string parsed to an object, including dynamic route parameters. It will be an empty object during prerendering if the page doesn't use Server-side Rendering. Defaults to {}
asPath:
String - The path (including the query) shown in the browser without the configured basePath or locale.
isFallback:
boolean - Whether the current page is in fallback (退路) mode.
basePath:
String - The active basePath (if enabled).
locale:
String - The active locale (if enabled).
locales:
String[] - All supported locales (if enabled).
defaultLocale:
String - The current default locale (if enabled).
domainLocales:
Array<{domain, defaultLocale, locales}> - Any configured domain locales.
isReady: boolean - Whether the router fields are updated client-side and ready for use. Should only be used inside of useEffect methods and not for conditionally (条件) rendering on the server. See related docs for use case with automatically statically (静态) optimized pages
isPreview:
boolean - Whether the application is currently in preview mode.