|
@@ -179,6 +179,9 @@
|
|
|
></i>
|
|
|
|
|
|
<i
|
|
|
+ v-clipboard:copy="scope.row.extractCode"
|
|
|
+ v-clipboard:success="copySuc"
|
|
|
+ v-clipboard:error="copyFail"
|
|
|
title="复制文本"
|
|
|
style="color: #00bf78"
|
|
|
v-show="
|
|
@@ -186,7 +189,7 @@
|
|
|
scope.row.extractCode != null &&
|
|
|
scope.row.extractCode != ''
|
|
|
"
|
|
|
- @click="onCopy(scope.row)"
|
|
|
+
|
|
|
class="el-icon-copy-document"
|
|
|
></i>
|
|
|
<i
|
|
@@ -200,13 +203,16 @@
|
|
|
></i>
|
|
|
|
|
|
<i
|
|
|
+ v-clipboard:copy="scope.row.extractCode"
|
|
|
+ v-clipboard:success="copySuc"
|
|
|
+ v-clipboard:error="copyFail"
|
|
|
title="复制文本"
|
|
|
v-show="
|
|
|
!scope.row.isShow &&
|
|
|
scope.row.extractCode != null &&
|
|
|
scope.row.extractCode != ''
|
|
|
"
|
|
|
- @click="onCopy(scope.row)"
|
|
|
+
|
|
|
class="el-icon-copy-document"
|
|
|
></i>
|
|
|
</div>
|
|
@@ -476,10 +482,32 @@ export default {
|
|
|
this.searchTarget();
|
|
|
},
|
|
|
methods: {
|
|
|
+ copySuc(){
|
|
|
+ this.$message.success("复制成功")
|
|
|
+},
|
|
|
+
|
|
|
+copyFail(){
|
|
|
+ this.$message.success("复制失败")
|
|
|
+},
|
|
|
onCopy(row) {
|
|
|
- navigator.clipboard.writeText(row.extractCode).then(() => {
|
|
|
- this.$message.success("复制成功");
|
|
|
- });
|
|
|
+ if (navigator.clipboard && window.isSecureContext) {
|
|
|
+ navigator.clipboard.writeText(row.extractCode).then(() => {
|
|
|
+ this.$message.success("复制成功");
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ const textArea = document.createElement('textarea')
|
|
|
+ textArea.value = val
|
|
|
+ // 使text area不在viewport,同时设置不可见
|
|
|
+ document.body.appendChild(textArea)
|
|
|
+ textArea.focus()
|
|
|
+ textArea.select()
|
|
|
+ this.$message.success('复制成功')
|
|
|
+ return new Promise((res, rej) => {
|
|
|
+ // 执行复制命令并移除文本框
|
|
|
+ document.execCommand('copy') ? res() : rej()
|
|
|
+ textArea.remove()
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
titleFormatter(val) {
|
|
|
if (val.planStatus == "1") {
|