其他分享
首页 > 其他分享> > js confirm/copy

js confirm/copy

作者:互联网

this.$confirm('内容', '标题', {               dangerouslyUseHTMLString: true,               confirmButtonText: '复制', //按钮的文本               showClose: false,               showCancelButton: false,               center: true //居中             }).then(res => {                 const copyStr = `复制的内容`             const oInput = document.createElement('input')             oInput.value = copyStr             document.body.appendChild(oInput)             oInput.select()// 选择对象;             const copyResult = document.execCommand('copy')// 执行浏览器复制命令             document.body.removeChild(oInput)      //可单独取出使用               if (copyResult) {               this.$message.success('已复制到粘贴板')             } else {               this.$message.error('复制失败')             }           })         }

标签:document,const,confirm,copyResult,js,复制,oInput,false,copy
来源: https://www.cnblogs.com/chaplink/p/15806391.html