d-utils
Version:
d-utils
16 lines (15 loc) • 643 B
JavaScript
/**
* d-utils version: 4.0.3
* by ifmiss
*/
/**
* @description 移除url的某一个参数
* @since 3.0.1
* @param { Array } paramNames 参数名称的数组
* @param { URL } url url地址
* @return { String } 返回一个新地址
* @example
* UrlUtils.deleteUrlParam(['code', 'name'], 'http://localhost:2008/#a?a=22&b=2&code=3')
* // 'http://localhost:2008/#a?a=22&b=2'
*/
function t(t,r){void 0===r&&(r=location.href);var e=r.split("?")[1];if(!e)return r;var n=r.split("?")[0],o=new URLSearchParams(e);return t.forEach((function(t){o.delete(t)})),o.toString()?n+"?"+o.toString():n}export default t;export{t as deleteUrlParam};