提交 a377f202 编写于 作者: peng.zhao's avatar peng.zhao

add copy

上级 0117f4c8
...@@ -80,11 +80,21 @@ ...@@ -80,11 +80,21 @@
v-for="item in tableDataList.columnList" v-for="item in tableDataList.columnList"
> >
<el-table-column <el-table-column
:prop="item.key" :width="item.key === 'column1' ? '150px' : 'auto'"
align="center"
:label="item.value" :label="item.value"
align="center"
show-overflow-tooltip show-overflow-tooltip
></el-table-column> >
<template slot-scope="scope">
<div @click="copyTitle(scope.row[item.key])" v-if="item.key === 'column1'">
<span>{{ scope.row[item.key] }}</span>
<img class="user-logo" src="../../../static/img/copy.png" style="width: 15px; height: 15px;">
</div>
<div v-else>
<span>{{ scope.row[item.key] }}</span>
</div>
</template>
</el-table-column>
</template> </template>
<el-table-column <el-table-column
v-if="tableDataList && tableDataList.columnList" v-if="tableDataList && tableDataList.columnList"
...@@ -410,6 +420,15 @@ export default { ...@@ -410,6 +420,15 @@ export default {
vm.handleForbid(); // 禁止默认事件 vm.handleForbid(); // 禁止默认事件
}, },
methods: { methods: {
copyTitle(value) {
this.copyText(value);
},
copyText(text) {
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
}
this.$message.success("复制成功");
},
handleForbid() { handleForbid() {
document.oncontextmenu = function () { document.oncontextmenu = function () {
return false; return false;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册