clipboard.js 实现web端---> 复制到剪切板功能

package.json 中: 添加clipboard 依赖

"dependencies": {
"vue": "^2.2.2",
"vue-router": "^2.3.0",
"vue-resource": "^1.3.1",
"deepmerge": "^1.3.1",
"async-validator": "^1.6.7",
"popper.js": "^0.6.4",
"vuex": "^2.0.0",
"clipboard": "^1.7.1"
}, 引入:
import Clipboard from 'clipboard'

用法:
new Clipboard('#copybtn', {
text: function(trigger) {
return "aaaaa"; // aaaaa为设置到剪切板的内容
}
});

上一篇:发布一个npm包(webpack loader)


下一篇:webpack loader & pulgin