Skip to content

useRouteHash ​

Category
Export Size
380 B
Package
@vueuse/router
Last Changed
yesterday

Shorthand for a reactive route.hash. Available in the @vueuse/router add-on.

Usage ​

ts
import { useRouteHash } from '@vueuse/router'

const search = useRouteHash()

console.log(search.value) // route.hash
search.value = 'foobar' // router.replace({ hash: 'foobar' })

Type Declarations ​

typescript
export declare function useRouteHash(
  defaultValue?: MaybeRefOrGetter<RouteHashValueRaw>,
  { mode, route, router }?: ReactiveRouteOptions,
): Ref<RouteHashValueRaw, RouteHashValueRaw>

Source ​

Source • Docs

Contributors ​

Anthony Fu
Anthony Fu
Antério Vieira
Lindsay Gaines
Dvir Hazout
Curt Grimes

Changelog ​

Pending for release...
59f75 - feat(toValue): deprecate toValue from @vueuse/shared in favor of Vue's native
v12.0.0-beta.1 on 11/21/2024
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v11.0.0-beta.3 on 8/14/2024
965bf - fix(useRouteHash, useRouteParams, useRouteQuery): fix effect triggering multiple times (#4113)
v10.3.0 on 7/30/2023
0d02f - fix(router): improves router functions: synchronize values, adds tests, and optimize performance (#3184)
v10.2.0 on 6/16/2023
d5252 - fix(useRouteHash,useRouteQuery,useRouteParams): re-evaluates the value immediately (#3002)

Released under the MIT License.