1
1
<template >
2
2
<el-dialog title =" 代码预览" v-model =" codeDialogVisible" width =" 70%" top =" 10vh" :before-close =" handleClose" :center =true >
3
3
<!-- 这里加v-if是因为CodeEditor内部不支持watch数据监测 -->
4
- <CodeEditor v-if =" codeDialogVisible" style =" max-height : 65 vh ;" ref =" codeEditor" :initCode =" outputCode"
4
+ <CodeEditor v-if =" codeDialogVisible" style =" max-height : 55 vh ;" ref =" codeEditor" :initCode =" outputCode"
5
5
mode =" text/html" ></CodeEditor >
6
6
<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 ;" >
8
8
<el-row >
9
- <el-col :span =" 10 " >
9
+ <el-col :span =" 6 " >
10
10
输出形式:
11
- <el-radio-group v-model =" outputMode" >
11
+ <el-radio-group v-model =" outputMode" style = " display : flex ; flex-direction : column ; " >
12
12
<el-radio label =" vue" >Vue</el-radio >
13
13
<el-radio label =" html" >单页Html</el-radio >
14
14
</el-radio-group >
15
+ </el-col >
15
16
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 >
16
24
</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 >
25
37
<el-button size =" small" type =" danger" :loading =" loading" @click =" release" >
26
38
一键部署至VCC静态页面托管服务</el-button >
27
39
<div v-if =" accessUrl" >部署成功:<a :href =" accessUrl" target =" _blank" >{{accessUrl}}</a ></div >
@@ -57,7 +69,9 @@ export default {
57
69
iconCopy: (" https://static.imonkey.xueersi.com/download/vcc-resource/icon/copy-outline.svg" ),
58
70
iconDownload: (" https://static.imonkey.xueersi.com/download/vcc-resource/icon/code-download-outline.svg" ),
59
71
loading: false ,
60
- accessUrl: ' '
72
+ accessUrl: ' ' ,
73
+ fileName: ' ' ,
74
+ checkList: [' ele' ]
61
75
};
62
76
},
63
77
beforeCreate () { },
@@ -70,7 +84,7 @@ export default {
70
84
methods: {
71
85
release () {
72
86
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 => {
74
88
this .accessUrl = res .data .data ;
75
89
this .loading = false ;
76
90
}).catch (err => {
0 commit comments