v3.8.0 代码生成预览支持复制内容

This commit is contained in:
YunaiV 2022-02-17 18:13:27 +08:00
parent ca4290204c
commit 9724a522e9
1 changed files with 5 additions and 0 deletions

View File

@ -69,6 +69,7 @@
<el-tabs v-model="preview.activeName"> <el-tabs v-model="preview.activeName">
<el-tab-pane v-for="item in preview.data" :label="item.filePath.substring(item.filePath.lastIndexOf('/') + 1)" <el-tab-pane v-for="item in preview.data" :label="item.filePath.substring(item.filePath.lastIndexOf('/') + 1)"
:name="item.filePath" :key="item.filePath"> :name="item.filePath" :key="item.filePath">
<el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="item.code" v-clipboard:success="clipboardSuccess" style="float:right">复制</el-link>
<pre><code class="hljs" v-html="highlightedCode(item)"></code></pre> <pre><code class="hljs" v-html="highlightedCode(item)"></code></pre>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -245,6 +246,10 @@ export default {
const result = hljs.highlight(language, item.code || "", true); const result = hljs.highlight(language, item.code || "", true);
return result.value || '&nbsp;'; return result.value || '&nbsp;';
}, },
/** 复制代码成功 */
clipboardSuccess(){
this.$modal.msgSuccess("复制成功");
},
/** 生成 files 目录 **/ /** 生成 files 目录 **/
handleFiles(datas) { handleFiles(datas) {
let exists = {}; // keyfile idvaluetrue let exists = {}; // keyfile idvaluetrue