天天看點

擷取url參數值

擷取url參數值,記錄一下友善以後用到

// 擷取url參數
const getUrlKey = name => {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
};      

轉載于:https://www.cnblogs.com/double405/p/11445898.html