获取当前页面的URL

语法

  1. import { getCurrentUrl } from 'warbler-js';
  2. const result = getCurrentUrl()

参数

  • null

返回值

String : 当前页面的 URL

源码

  1. const getCurrentUrl = () => window.location.href;

例子

  1. import { getCurrentUrl } from 'warbler-js';
  2. const result = getCurrentUrl()
  3. console.log(result) //=>http://warblerjs.duwanyu.com