共计 596 个字符,预计需要花费 2 分钟才能阅读完成。
复制到剪贴板
function copyToClipboard(val) {let aux = document.createElement("input");
aux.setAttribute("value", val);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
showDefaultTips('已胜利复制到剪贴板','',1)
}
获取 url 参数
function getQueryVariable() {let query = window.location.search.substring(1);
let vars = query.split("&");
let res = {};
for (let i = 0; i < vars.length; i++) {let pair = vars[i].split("=");
if (pair[0] !== "") {let val = decodeURIComponent(pair[1]);
if (val.includes("|")) {
val = val
.split("|")
.filter((item) => item !== "")
.join(",");
}
if (val === "null") val = "";
res[pair[0]] = val;
}
}
return res;
}
正文完
发表至: javascript
2021-01-05