trigger: load
state: null
length: 3
hash: ''
host: v5-3-0.vueuse.org
hostname: v5-3-0.vueuse.org
href: https://v5-3-0.vueuse.org/core/usebrowserlocation/
origin: https://v5-3-0.vueuse.org
pathname: /core/usebrowserlocation/
port: ''
protocol: 'https:'
search: ''

useBrowserLocation

Reactive browser location

Usage

import { useBrowserLocation } from '@vueuse/core'

const location = useBrowserLocation()

Component

<UseBrowserLocation v-slot="{ location }">
  Browser Location: {{ location }}
</UseBrowserLocation>
Learn more about component usage

Type Declarations

export interface BrowserLocationState {
  trigger: string
  state?: any
  length?: number
  hash?: string
  host?: string
  hostname?: string
  href?: string
  origin?: string
  pathname?: string
  port?: string
  protocol?: string
  search?: string
}
/**
 * Reactive browser location.
 *
 * @see /useBrowserLocation
 * @param options
 */
export declare function useBrowserLocation({
  window,
}?: ConfigurableWindow): Ref<{
  trigger: string
  state?: any
  length?: number | undefined
  hash?: string | undefined
  host?: string | undefined
  hostname?: string | undefined
  href?: string | undefined
  origin?: string | undefined
  pathname?: string | undefined
  port?: string | undefined
  protocol?: string | undefined
  search?: string | undefined
}>
export declare type UseBrowserLocationReturn = ReturnType<
  typeof useBrowserLocation
>

Source

SourceDemoDocs