Copy value from button

I’m trying to copy de value from a button to the clipboard.
But im always copying the previous value. I’m new to vue, and i guess the problem is that im putting the input into a var ( let copyText = document.querySelector(’#inpudID’);), and there must be a better way in vue.

<div id="container">
        <input :type="cStype" :id="cSid" :value="code">
  <button v-on:click="copyCode" value="1">1</button>
  <button v-on:click="copyCode" value="2">2</button>
  <button v-on:click="copyCode" value="3">3</button>
  <button v-on:click="copyCode" value="4">4</button>
new Vue({
    el: "#container",

    data: {
        code: '0',
        cSid: 'inpudID',
        cStype: 'hidden'

    methods: {
        copyCode: function (e) {
            this.code =;
            this.cStype = 'text';
            let copyText = document.querySelector('#inpudID');
            //this.cStype = 'hidden';

Make the method async:

thank you!

Any idea why this work in 2.2.1, but doesn’t work in 2.6.12?

It should still work in any version of Vue, it’s just an async method.

Done with the latest version of Vue: