Commit 31be7da1 authored by rockyl's avatar rockyl

拷贝模板到粘贴板

parent e667fb72
......@@ -72,6 +72,7 @@
"Meta Editor": "Meta Editor",
"Env editor": "Env editor",
"As inline": "As inline",
"Copy template to clipboard": "Copy template to clipboard",
"Link to parent": "Link to parent",
"Input project name": "Input project name",
"Invalid project name": "Invalid project name",
......
......@@ -72,6 +72,7 @@
"Meta Editor": "过程元配置",
"Env editor": "环境编辑器",
"As inline": "作为内联",
"Copy template to clipboard": "复制模板到粘贴板",
"Link to parent": "连接到父节点",
"Input project name": "输入项目名",
"Invalid project name": "无效的项目名",
......
......@@ -12,6 +12,7 @@
<inspector splitpanes-min="20" :splitpanes-size="getSize(0, 1)"></inspector>
</split-panes>
<details-dialog ref="dialogsDialog"/>
<pack-result-dialog ref="packResultDialog"/>
</div>
</template>
......@@ -26,10 +27,12 @@
import DetailsDialog from "./Editor/dialogs/DetailsDialog";
import {playWaiting} from "../utils";
import i18n from "../i18n";
import PackResultDialog from "./Editor/dialogs/PackResultDialog";
export default {
name: 'Editor',
components: {
PackResultDialog,
DetailsDialog,
Assets,
Playground,
......@@ -192,13 +195,14 @@
});
try{
await this.saveProject();
const {tplUrl} = await this.packProject();
const packResult = await this.packProject();
this.$message({
message: this.$t('Pack project successfully'),
type: 'success',
duration: 1000,
});
this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
this.$refs.packResultDialog.show(packResult);
/*this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
confirmButtonText: this.$t('Open in new tab'),
cancelButtonText: this.$t('Close'),
type: 'warning'
......@@ -208,7 +212,7 @@
}, 500);
}).catch(() => {
});
});*/
}catch (e) {
this.$message({
message: this.$t('Pack project failed'),
......
<template>
<el-dialog :title="$t('Project details')" width="70%" :visible.sync="visible" @open="onOpen"
:close-on-click-modal="false"
:append-to-body="true"
:show-close="false"
custom-class="details-dialog"
>
<div>
<p>{{$t('Pack project successfully')}}</p>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="onClose">{{$t('Close')}}</el-button>
<el-button size="mini" @click="copy">{{$t('Copy template to clipboard')}}</el-button>
<el-button size="mini" type="primary" @click="openInNewTab">{{$t('Open in new tab')}}</el-button>
</div>
</el-dialog>
</template>
<script>
import copy from 'copy-to-clipboard'
export default {
name: "PackResultDialog",
components: {},
data() {
return {
visible: false,
activeName: 'project',
packResult: null,
}
},
methods: {
show(packResult) {
this.packResult = packResult;
this.visible = true;
},
onClose() {
this.visible = false;
},
openInNewTab() {
this.visible = false;
setTimeout(()=>{
window.open(this.packResult.tplUrl, 'blank');
}, 500);
},
copy() {
this.visible = false;
copy(this.packResult.tpl);
},
onOpen() {
},
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment