Skip to content

Commit

Permalink
fix: improve example
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW committed Jan 14, 2025
1 parent 2adce0b commit d548970
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/composables/useQuery.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { MaybeRef } from '@vueuse/core'

export function useQuery(key?: MaybeRef<string>) {
export function useQuery(key?: MaybeRefOrGetter<string>) {
const query = ref<AnyObject>({})
onLoad((q) => {
query.value = q || {}
})
const value = computed(() => (key ? query.value[unref(key)] : null))
const value = computed(() => (key ? query.value[toValue(key)] : null))
return { query, value }
}

0 comments on commit d548970

Please sign in to comment.