File tree Expand file tree Collapse file tree 4 files changed +16
-2
lines changed
views/instance/components Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,9 @@ const instance = {
7272 setIframeInit : ( state , isInit ) => {
7373 state . iframeInit = isInit
7474 } ,
75+ setHasUploadCode : ( state , status ) => {
76+ state . hasUploadCode = status
77+ }
7578}
7679
7780export default instance
Original file line number Diff line number Diff line change @@ -58,10 +58,13 @@ const instance = {
5858 tags : '' ,
5959 liked : false ,
6060 id : '' ,
61- saved : true // 当前实例是否被保存了
61+ saved : true , // 当前实例是否被保存了
62+ ispublic : true ,
6263 } ,
6364
64- iframeInit : false // iframe是否被初始化过
65+ iframeInit : false , // iframe是否被初始化过
66+
67+ hasUploadCode : false // 当前是否有代码上传
6568}
6669
6770export default instance
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export default {
6464 ' setInstanceCode' ,
6565 ' setPrep' ,
6666 ' setCurTab' ,
67+ ' setHasUploadCode'
6768 ]),
6869 chooseFile () {
6970 // 判断上传的文件中哪些是符合后缀名要求的
@@ -96,6 +97,7 @@ export default {
9697 const fileList = this .fileList
9798 const resolve = this .resolve
9899 const codeObj = {}
100+ this .setHasUploadCode (false )
99101 await uploader (fileList, resolve).then ((res ) => {
100102 let visibleTab = ' '
101103 const { HTML , CSS , JavaScript } = res
@@ -147,6 +149,8 @@ export default {
147149 })
148150 }
149151 this .fileList = []
152+ this .setHasUploadCode (true )
153+ this .$refs .fileInput .value = ' '
150154 this .$message .success (' 所有文件已全部上传成功!' )
151155 } catch (err) {
152156 this .$message .error (' 文件上传过程出错!' )
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export default {
5555 ' instanceSetting' ,
5656 ' mdToolbarVisible' ,
5757 ' curTab' ,
58+ ' hasUploadCode' ,
5859 ]),
5960 fontStyle () {
6061 const { family: fontFamily , size: fontSize } = this .instanceSetting .font
@@ -69,6 +70,9 @@ export default {
6970 },
7071 },
7172 watch: {
73+ hasUploadCode (status ) {
74+ if (status) this .code = this .codeContent
75+ },
7276 codeMode (newMode ) {
7377 const codeOptions = this .codeOptions
7478 codeOptions .mode = modeStyleList[newMode]
You can’t perform that action at this time.
0 commit comments