Skip to content
On this page

useRouteHash

Category
Export Size
185 B
Package
@vueuse/router
Last Changed
4 months ago

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' })
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?: string,
  { mode, route, router }?: ReactiveRouteOptions
): WritableComputedRef<string>
export declare function useRouteHash(
  defaultValue?: string,
  { mode, route, router }?: ReactiveRouteOptions
): WritableComputedRef<string>

Source

SourceDocs

Contributors

Anthony Fu
Dvir Hazout
Curt Grimes

Changelog

v9.4.0 on 10/25/2022
be36a - fix(useRouteHash, useRouteParams, useRouteQuery): override only selected route param (#2350)

Released under the MIT License.