Vue.component('Copybox',{
    template : `
      <div class="y2t-output">
        <button v-on:click="copyToClipboard">Copy</button>
        <p>{{ txt }}</p>
      </div>
    `,
    props : {
      txt : String
    },
    methods : {
      copyToClipboard() {
        navigator.clipboard.writeText(this.txt).then(() => {
          console.log('Text copied to clipboard');
        }, (err) => {
          console.error('Failed to copy text: ', err);
        });
      },
    }
})

let vm = new Vue({
    
}).$mount('#root')