mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-01 14:05:44 +08:00
fix: 限定文件导入的格式
This commit is contained in:
parent
8e1c11b8e6
commit
88f33ff56a
@ -206,9 +206,14 @@ class ProjectData extends Component {
|
||||
|
||||
handleAddInterface(info){
|
||||
if(this.state.selectCatid){
|
||||
let filename = info.file.name;
|
||||
let filetype = filename.substr(filename.lastIndexOf(".")).toLowerCase();
|
||||
// console.log(filename,filetype);
|
||||
if(filetype != ".json") return message.error("文件格式只能为json");
|
||||
let reader = new FileReader();
|
||||
reader.readAsText(info.file);
|
||||
reader.onload = (res)=>{
|
||||
|
||||
res = res.target.result;
|
||||
try{
|
||||
res = JSON.parse(res);
|
||||
|
Loading…
Reference in New Issue
Block a user