| 'time'
| 'true'
| 'false'
+
+ /**
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
+ */
+ viewTransition?: boolean
}
/**
| RouteLocationAsPath
| RouteLocationRaw
>
+
replace?: MaybeRef<boolean | undefined>
+
+ /**
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
+ */
+ viewTransition?: boolean
}
/**
e: MouseEvent = {} as MouseEvent
): Promise<void | NavigationFailure> {
if (guardEvent(e)) {
- return router[unref(props.replace) ? 'replace' : 'push'](
+ const p = router[unref(props.replace) ? 'replace' : 'push'](
unref(props.to)
// avoid uncaught errors are they are logged anyway
).catch(noop)
+ if (
+ props.viewTransition &&
+ typeof document !== 'undefined' &&
+ 'startViewTransition' in document
+ ) {
+ // @ts-expect-error: not added to types yet
+ document.startViewTransition(() => p)
+ }
+ return p
}
return Promise.resolve()
}