Parcourir la source

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

RuoYi il y a 4 ans
Parent
commit
4db3e90872
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      ruoyi-ui/src/views/tool/gen/index.vue

+ 6 - 1
ruoyi-ui/src/views/tool/gen/index.vue

@@ -169,7 +169,8 @@
169 169
           :name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
170 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 174
         </el-tab-pane>
174 175
       </el-tabs>
175 176
     </el-dialog>
@@ -306,6 +307,10 @@ export default {
306 307
       const result = hljs.highlight(language, code || "", true);
307 308
       return result.value || '&nbsp;';
308 309
     },
310
+    /** 复制代码成功 */
311
+    clipboardSuccess(){
312
+      this.$modal.msgSuccess("复制成功");
313
+    },
309 314
     // 多选框选中数据
310 315
     handleSelectionChange(selection) {
311 316
       this.ids = selection.map(item => item.tableId);