vue copy content

        <el-table-column
          label="地址"
          align="center"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <a
              @click="copyUrl(scope.row.url)"
              >{
   
   { scope.row.url }}</a
            >
          </template>
        </el-table-column>
    copyUrl (val) {
    
    
      var cInput = document.createElement("input");
      cInput.value = val;
      document.body.appendChild(cInput);
      cInput.select();
      document.execCommand("copy");
      this.$message({
    
    
        type: "success",
        message: "复制成功"
      });
      document.body.removeChild(cInput);
    },

Guess you like

Origin blog.csdn.net/q249859693/article/details/128486280