Comments (2)
fix the bug by
Vue.prototype.$copyText = function (text, container) {
return new Promise(function (resolve, reject) {
var fakeElement = document.createElement('button')
var clipboard = new Clipboard(fakeElement, {
text: function () { return text },
action: function () { return 'copy' },
container: typeof container === 'object' ? container : document.body
})
clipboard.on('success', function (e) {
clipboard.destroy()
resolve(e)
})
clipboard.on('error', function (e) {
clipboard.destroy()
reject(e)
})
document.body.appendChild(fakeElement);
fakeElement.click();
document.body.removeChild(fakeElement);
})
from vue-clipboard2.
Fixed in v0.3.0
from vue-clipboard2.
Related Issues (20)
- 有一些字符会被转义 HOT 1
- 有一些字符会被转义
- How i use clipboard intro render function
- Focus must stay on the link/button HOT 1
- get error Cannot read property 'nodeName' of null
- 希望可以将web中的表格复制至excel中!?
- 以下示例中会出现copy失败,特别是在ios或者安卓手机端。 HOT 2
- large data cannot copy
- 销毁 clipboard 前是否应该取消订阅?
- 安卓11好像不兼容啊
- Number Support
- v-clipboard's copy function fails while using cypress
- using vue-clipboard2 on Vue 3 + Typescript HOT 1
- clipboard2 hasAttribute is not a function HOT 1
- what should be the type of event in copy method
- in ie11,Call this$ CopyText will prompt that the property object does not support 'remove'
- How to disable enter key? HOT 2
- Events not being prevented
- not work on vuetify dialog HOT 8
- copy the rendered element problem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-clipboard2.