之前只能用flash来粘贴,太麻烦。
github就不用flash也能粘贴,参考例子:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Copy测试页面</title>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
</head>
<body>
<!-- Target -->
<input id="foo" value="https://github.com/zenorocha/clipboard.js.git">
<!-- Trigger -->
<button class="btn" data-clipboard-target="#foo">
Copy to clipboard
</button>
<script>
new ClipboardJS('.btn');
</script>
</body>
</html>
以往粘贴需用flash,操作麻烦。而GitHub不用flash就能实现粘贴功能,还给出参考例子https://clipboardjs.com/ 。
3569

被折叠的 条评论
为什么被折叠?



