Skip to content

Commit

Permalink
docs: show default value example for useRouteQuery (vitest-dev#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallswain committed Jul 23, 2021
1 parent cb1b777 commit 2591fcd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/router/useRouteQuery/index.md
Expand Up @@ -13,6 +13,8 @@ import { useRouteQuery } from '@vueuse/router'

const search = useRouteQuery('search')

const search = useRouteQuery('search', 'foo') // or with a default value

console.log(search.value) // route.query.search
search.value = 'foobar' // router.replace({ query: { search: 'foobar' } })
```
Expand All @@ -25,6 +27,7 @@ search.value = 'foobar' // router.replace({ query: { search: 'foobar' } })
export declare function useRouteQuery(
name: string
): Ref<null | string | string[]>

export declare function useRouteQuery<
T extends null | string | string[] = null | string | string[]
>(name: string, defaultValue?: T, options?: ReactiveRouteOptions): Ref<T>
Expand Down

0 comments on commit 2591fcd

Please sign in to comment.