We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d1ae98d + a8fc101 commit 6755e12Copy full SHA for 6755e12
vue-clipboard.js
@@ -2,12 +2,13 @@ var Clipboard = require('clipboard/dist/clipboard.min.js') // FIXME: workaround
2
3
var VueClipboard = {
4
install: function (Vue) {
5
- Vue.prototype.$copyText = function (text) {
+ Vue.prototype.$copyText = function (text, container) {
6
return new Promise(function (resolve, reject) {
7
var fake_el = document.createElement('button');
8
var clipboard = new Clipboard(fake_el, {
9
text: function () { return text },
10
- action: function () { return 'copy' }
+ action: function () { return 'copy' },
11
+ container: typeof container === 'object' ? container : document.body
12
});
13
clipboard.on('success', function (e) {
14
clipboard.destroy();
0 commit comments