Browse Source

!631 【功能完善】文件列表: 添加复制链接功能
Merge pull request !631 from jinmh/master

芋道源码 7 months ago
parent
commit
7b7ce96c66
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/views/infra/file/index.vue

+ 14 - 0
src/views/infra/file/index.vue

@@ -95,6 +95,13 @@
       />
       <el-table-column label="操作" align="center">
         <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="copyToClipboard(scope.row.url)"
+          >
+            复制链接
+          </el-button>
           <el-button
             link
             type="danger"
@@ -172,6 +179,13 @@ const openForm = () => {
   formRef.value.open()
 }
 
+/** 复制到剪贴板方法 */
+const copyToClipboard = (text: string) => {
+  navigator.clipboard.writeText(text).then(() => {
+    message.success('复制成功')
+  })
+}
+
 /** 删除按钮操作 */
 const handleDelete = async (id: number) => {
   try {