vue点击复制

关键代码如下

copyRequestBody(row) {
            let url = row.requestBody;
            let oInput = document.createElement('input');
            oInput.value = url;
            document.body.appendChild(oInput);
            oInput.select(); // 选择对象;
            console.log(oInput.value)
            document.execCommand("Copy"); // 执行浏览器复制命令
            this.$message({
                message: '复制成功',
                type: 'success'
            });
            oInput.remove()
        },

 

posted @ 2022-05-17 16:57  君子笑而不语  阅读(66)  评论(0编辑  收藏  举报