Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 926 Bytes

README.md

File metadata and controls

54 lines (40 loc) · 926 Bytes

copy-to-clipboard3

配置和代码基本和copy-to-clipboard一致,解决document.execCommand('copy')引起的页面卡顿和延迟

复制后不会恢复页面原来的高亮

安装

npm i copy-to-clipboard3

使用

import copy from 'copy-to-clipboard3';
 
copy('Text');
 
// Copy with options
copy('Text', {
  debug: true,
  format: 'default'
});

⚠ 使用警告

提供的是未转译的版本:

针对 Vue CLI 3+, 需要这样:

module.exports = {
  transpileDependencies: [
    'copy-to-clipboard3',
  ]
}

针对 Vue CLI 2 需要这样:

      {
        test: /\.js$/,
        loader: 'babel-loader',
-       include: [resolve('src'), resolve('test')]
+       include: [
+         resolve('src'),
+         resolve('test'),
+         resolve('node_modules/copy-to-clipboard3'),
+       ]
      }