/**
一键复制
@param {String} inputValue [需要复制的内容]
range + selection
1.创建一个 range
2.把内容放入 range
3.把 range 放入 selection
注意:对于 user-select: none 的元素无效
*/
function onCopyText(inputValue) {
var ele = document.createElement('div');
ele.id = 'eleCopyText';
ele.style.opacity = '0';
ele.innerText = inputValue;
document.body.appendChild(ele);

try {
var range = document.createRange();
range.selectNode(ele);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand('copy');
window.getSelection().removeAllRanges();
alert('复制链接成功')
} catch (e) {
alert('复制链接失败')
}

// remove temp ele
ele.parentElement.removeChild(ele);
}