方式一:ES6
安装
npm i --save copy-to-clipboard
示例
import copy from 'copy-to-clipboard';
copy('Text');
方式二:CDN
下载
wget http://sudodoki.name/copy-to-clipboard/example/index.js -O copy-to-clipboard.min.js
<script src="./copy-to-clipboard.min.js"></script>
<script type="text/javascript">
copyToClipboard('Text');
</script>