vue用button实现粘贴功能

已经写好了复制,现在不知道怎么用按钮粘上

    copyToClipboard(elemRef) {
    let target;
    let succeed = false;
    if(this.$refs[elemRef]){
      target = this.$refs[elemRef];
      // 选择内容
      let currentFocus = document.activeElement;
      target.focus();
      target.setSelectionRange(0, target.value.length);

      // 复制内容
      try {
        succeed = document.execCommand("copy");
        alert("内容复制成功");


      } catch (e) {
        succeed = false;


      }
      // 恢复焦点
      if (currentFocus && typeof currentFocus.focus === "function") {
        currentFocus.focus();
      }
    }
    return succeed;
  },

        <el-button 
        data-clipboard-text="copy" 
        @click="copyToClipboard('text')"
        type="primary" >Copy 
        </el-button>

copyToClipboard方法不应该定义在methods里面吗?