Commit 9724a522e9755f6154a82b5f2a0a397662029ab8
1 parent
ca429020
v3.8.0 代码生成预览支持复制内容
Showing
1 changed file
with
5 additions
and
0 deletions
yudao-ui-admin/src/views/tool/codegen/index.vue
| ... | ... | @@ -69,6 +69,7 @@ |
| 69 | 69 | <el-tabs v-model="preview.activeName"> |
| 70 | 70 | <el-tab-pane v-for="item in preview.data" :label="item.filePath.substring(item.filePath.lastIndexOf('/') + 1)" |
| 71 | 71 | :name="item.filePath" :key="item.filePath"> |
| 72 | + <el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="item.code" v-clipboard:success="clipboardSuccess" style="float:right">复制</el-link> | |
| 72 | 73 | <pre><code class="hljs" v-html="highlightedCode(item)"></code></pre> |
| 73 | 74 | </el-tab-pane> |
| 74 | 75 | </el-tabs> |
| ... | ... | @@ -245,6 +246,10 @@ export default { |
| 245 | 246 | const result = hljs.highlight(language, item.code || "", true); |
| 246 | 247 | return result.value || ' '; |
| 247 | 248 | }, |
| 249 | + /** 复制代码成功 */ | |
| 250 | + clipboardSuccess(){ | |
| 251 | + this.$modal.msgSuccess("复制成功"); | |
| 252 | + }, | |
| 248 | 253 | /** 生成 files 目录 **/ |
| 249 | 254 | handleFiles(datas) { |
| 250 | 255 | let exists = {}; // key:file 的 id;value:true | ... | ... |