作者 RuoYi

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

@@ -169,7 +169,8 @@ @@ -169,7 +169,8 @@
169 :name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))" 169 :name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
170 :key="key" 170 :key="key"
171 > 171 >
172 - <pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre> 172 + <el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="value" v-clipboard:success="clipboardSuccess" style="float:right">复制</el-link>
  173 + <pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
173 </el-tab-pane> 174 </el-tab-pane>
174 </el-tabs> 175 </el-tabs>
175 </el-dialog> 176 </el-dialog>
@@ -306,6 +307,10 @@ export default { @@ -306,6 +307,10 @@ export default {
306 const result = hljs.highlight(language, code || "", true); 307 const result = hljs.highlight(language, code || "", true);
307 return result.value || '&nbsp;'; 308 return result.value || '&nbsp;';
308 }, 309 },
  310 + /** 复制代码成功 */
  311 + clipboardSuccess(){
  312 + this.$modal.msgSuccess("复制成功");
  313 + },
309 // 多选框选中数据 314 // 多选框选中数据
310 handleSelectionChange(selection) { 315 handleSelectionChange(selection) {
311 this.ids = selection.map(item => item.tableId); 316 this.ids = selection.map(item => item.tableId);