Comments (3)
Try the code below and check the debug console. Async method may be a problem since it's not triggered directly from a DOM event.
// app.ts
import VueClipboard from 'vue-clipboard2';
Vue.use(VueClipboard);
// component.vue
<template>
<button @click="doCopy">Copy</button>
</template>
export default Vue.extend({
name: '',
data: {},
methods: {
async doCopy(){
this.$copyText('copy content').then(function(e) {
console.log(['success', e])
}, function (e) {
console.log(['failed', e])
})
}
}
})
from vue-clipboard2.
I have done like this, but trigger the error event. copy failed
from vue-clipboard2.
You can not use $copyText
in async method, please read README and https://github.com/zenorocha/clipboard.js/wiki/Known-Limitations
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.