vue-clipboard2 icon indicating copy to clipboard operation
vue-clipboard2 copied to clipboard

What if i need to use Clipboard in bootstrap modal and in usuall place?

Open alexapp03 opened this issue 5 years ago • 3 comments

I cant make it working in both places using container option. What to do?

alexapp03 avatar Feb 28 '20 09:02 alexapp03

I used in modal this code this.$copyText(text, this.$refs.container), container is ref to our button copy. it works

alexapp03 avatar Feb 28 '20 09:02 alexapp03

Minimal reproduction sample please

Inndy avatar Mar 12 '20 07:03 Inndy

As stated by @moneyinvest you can solve this problem by using this.$copyText and passing the ref of a container that your element with v-clipboard is in.

Alternatively you can use VueClipboard.config.autoSetContainer = true in your main.js and the directive will work.

@Inndy Reproduction Sample with both solutions https://codesandbox.io/s/bootstrap-modal-vue-clipboard2-cx05k?file=/src/App.vue

giuliano-macedo avatar May 23 '21 14:05 giuliano-macedo