Skip to content

Commit 45e13cd

Browse files
author
shangbin
committed
feat: 更改代码输出布局
1 parent 0f766b9 commit 45e13cd

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

src/components/Code.vue

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
<template>
22
<el-dialog title="代码预览" v-model="codeDialogVisible" width="70%" top="10vh" :before-close="handleClose" :center=true>
33
<!-- 这里加v-if是因为CodeEditor内部不支持watch数据监测 -->
4-
<CodeEditor v-if="codeDialogVisible" style="max-height: 65vh;" ref="codeEditor" :initCode="outputCode"
4+
<CodeEditor v-if="codeDialogVisible" style="max-height: 55vh;" ref="codeEditor" :initCode="outputCode"
55
mode="text/html"></CodeEditor>
66
<div style="color: #666; font-size: 12px; text-align:center; margin: 5px;">使用代码前请确认相应的组件库已集成至项目</div>
7-
<div style="text-align:center;">
7+
<div style="text-align:left;">
88
<el-row>
9-
<el-col :span="10">
9+
<el-col :span="6">
1010
输出形式:
11-
<el-radio-group v-model="outputMode">
11+
<el-radio-group v-model="outputMode" style="display: flex; flex-direction: column;">
1212
<el-radio label="vue">Vue</el-radio>
1313
<el-radio label="html">单页Html</el-radio>
1414
</el-radio-group>
15+
</el-col>
1516

17+
<el-col :span="6" v-if="outputMode === 'html'">
18+
选择所使用的组件库:
19+
<el-checkbox-group v-model="checkList" style="display: flex; flex-direction: column;">
20+
<el-checkbox label="ele">Element UI</el-checkbox>
21+
<el-checkbox label="antd">Ant Design</el-checkbox>
22+
<el-checkbox label="vant">Vant</el-checkbox>
23+
</el-checkbox-group>
1624
</el-col>
17-
<el-col :span="14" style="display: flex; align-items: center; justify-content: center;">
18-
<el-tooltip effect="dark" content="拷贝" placement="left">
19-
<img class="round-icon" :src="iconCopy" alt="" @click="copyCheck">
20-
</el-tooltip>
21-
<el-tooltip effect="dark" content="下载" placement="right">
22-
<img class="round-icon" :src="iconDownload" alt="" @click="download">
23-
</el-tooltip>
24-
<div style="display: inline-block;margin-left: 10px;">
25+
<el-col :span="10" style="display: flex; flex-direction: column;">
26+
代码获取方式:
27+
<div style="margin-top: 10px;">
28+
<el-tooltip effect="dark" content="拷贝" placement="left">
29+
<img class="round-icon" :src="iconCopy" alt="" @click="copyCheck">
30+
</el-tooltip>
31+
<el-tooltip effect="dark" content="下载" placement="right">
32+
<img class="round-icon" :src="iconDownload" alt="" @click="download">
33+
</el-tooltip>
34+
</div>
35+
<div style="margin-top: 10px;" v-if="outputMode === 'html'">
36+
<el-input v-model="fileName" placeholder="部署文件名" style="width: 150px; margin-right: 10px;" size="small"></el-input>
2537
<el-button size="small" type="danger" :loading="loading" @click="release">
2638
一键部署至VCC静态页面托管服务</el-button>
2739
<div v-if="accessUrl">部署成功:<a :href="accessUrl" target="_blank">{{accessUrl}}</a></div>
@@ -57,7 +69,9 @@ export default {
5769
iconCopy: ("https://static.imonkey.xueersi.com/download/vcc-resource/icon/copy-outline.svg"),
5870
iconDownload: ("https://static.imonkey.xueersi.com/download/vcc-resource/icon/code-download-outline.svg"),
5971
loading: false,
60-
accessUrl: ''
72+
accessUrl: '',
73+
fileName: '',
74+
checkList: ['ele']
6175
};
6276
},
6377
beforeCreate() { },
@@ -70,7 +84,7 @@ export default {
7084
methods: {
7185
release() {
7286
this.loading = true;
73-
axios.post('https://apis.sahadev.tech/v1/file/upload', { "id": `index${createUniqueId()}`, "content": this.singleIndex }).then(res => {
87+
axios.post('https://apis.sahadev.tech/v1/file/upload', { "id": `index${this.fileName ? this.fileName : createUniqueId()}`, "content": this.singleIndex }).then(res => {
7488
this.accessUrl = res.data.data;
7589
this.loading = false;
7690
}).catch(err => {

0 commit comments

Comments
 (0)