代码语言:javascript复制
<script type="text/javascript">
function getUrlParams(url) {
const _url = url || window.location.href;
const _urlParams = _url.match(/([?&])(. ?=[^&] )/igm);
return _urlParams ? _urlParams.reduce((a, b) => {
const value = b.slice(1).split('=');
a[value[0]] = value[1]
return a;
}, {}) : {};
}
$(function() {
var code = getUrlParams()
$(".shareCode").text(code.code)
});
</script>