Skip to content

useLocationInfo

Introduction

返回当前页面链接相关信息

Type Declaration

ts
interface LocationInfo {
  href: string;
  hostname: string;
  port: number;
  pathname: string;
  params: string;
  hash: string;
}
/**
 * 返回当前页面链接相关信息
 * @returns
 */
declare function useLocationInfo(): Readonly<Partial<LocationInfo>> | null;

Online Demo

useLocationInfo
返回当前页面链接相关信息
<script lang="ts" setup>
import { useLocationInfo } from '@flypeng/tool/browser';

const locationInfo = useLocationInfo();
</script>

<template>
  <div>
    {{ locationInfo }}
  </div>
</template>

Released under the MIT License.