|
@@ -187,6 +187,14 @@ const onQuery = async () => {
|
|
|
const onChange=(api)=>{
|
|
|
state.selectVal=[]
|
|
|
state.tableVal=[]
|
|
|
+ state.selectBtn=state.selectBtn.map(item=>{
|
|
|
+ item.value=false
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ state.tableBtn=state.tableBtn.map(item=>{
|
|
|
+ item.value=false
|
|
|
+ return item
|
|
|
+ })
|
|
|
let data=dataJson.value.paths[api]
|
|
|
const tableData=dataJson.value.components.schemas
|
|
|
//console.log(data)
|
|
@@ -620,6 +628,23 @@ const onsubmit=()=>{
|
|
|
indexCode=indexCode+`\n</`+`script>`+`\n<style scoped lang="scss">
|
|
|
</style>`
|
|
|
//console.log(indexCode)
|
|
|
+ getCodeFile('api.ts',apiCode)
|
|
|
+ getCodeFile('dto.ts',dataCode)
|
|
|
+ getCodeFile('index.vue',indexCode)
|
|
|
+}
|
|
|
+const getCodeFile=(fileName,code) =>{
|
|
|
+ const blob = new Blob([code], { type: 'text/plain' });
|
|
|
+ const url = URL.createObjectURL(blob);
|
|
|
+ // 创建一个a标签并设置href为新文件的URL
|
|
|
+ const downloadLink = document.createElement('a');
|
|
|
+ downloadLink.href = url;
|
|
|
+ downloadLink.download = fileName; // 设置下载文件名
|
|
|
+ // 触发下载
|
|
|
+ document.body.appendChild(downloadLink);
|
|
|
+ downloadLink.click();
|
|
|
+ // 清理
|
|
|
+ document.body.removeChild(downloadLink);
|
|
|
+ URL.revokeObjectURL(url);
|
|
|
}
|
|
|
</script>
|
|
|
|