useRouteHash
对响应式的 route.hash
的简写。 Available in the @vueuse/router add-on.
用法
ts
import { useRouteHash } from '@vueuse/router'
const search = useRouteHash()
console.log(search.value) // route.hash
search.value = 'foobar' // router.replace({ hash: 'foobar' })
类型声明
typescript
export declare function useRouteHash(
defaultValue?: MaybeRefOrGetter<RouteHashValueRaw>,
{ mode, route, router }?: ReactiveRouteOptions,
): Ref<RouteHashValueRaw, RouteHashValueRaw>
Source
贡献者
Anthony Fu
丶远方
Antério Vieira
Anthony Fu
Lindsay Gaines
Dvir Hazout
Curt Grimes