vue项目中,点击按钮复制其内容

<el-table-column label="推广链接" align="center">
    <template slot-scope="scope">
        <el-button size="mini" type="infor" class="copy" data-clipboard-action="copy" :data-clipboard-text="'http://investor.jie360.com.cn/register/?key='+scope.row.registerUrl" @click="copyUrl">点击复制</el-button>
    </template>
</el-table-column>
copyUrl(){
            let _this = this;
     let clipboard = new this.clipboard(".copy");
     clipboard.on('success', function () {
       _this.$message({
                 message:'复制成功!',
                 type:'success'
             })
     });
     clipboard.on('error', function () {
                _this.$message.error("复制失败!")
     });
    },

 

原文地址:https://www.cnblogs.com/WangXinPeng/p/11624061.html