vue复制内容

        <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);
    },

猜你喜欢

转载自blog.csdn.net/q249859693/article/details/128486280
今日推荐