This commit is contained in:
caishi 2020-08-27 10:26:28 +08:00
parent ec073cdf71
commit 42a1418181
1 changed files with 11 additions and 1 deletions

View File

@ -19,6 +19,16 @@ import axios from "axios";
* subfileType:保存当前点击目录的文件类型显示目录列表时才显示新建文件如果点击的是文件就不显示新建文件按钮
* readMeContent:根目录下面的readme文件内容
*/
function getPathUrl(array,index){
if(array && array.length>0 && index){
let str = "";
for(let i=0;i<index;i++){
str += `/${array[i]}`;
}
return str.substr(1);
}
}
class CoderRootDirectory extends Component {
constructor(props) {
@ -465,7 +475,7 @@ class CoderRootDirectory extends Component {
key === array.length-1 ?
<span className="color-grey-6 subFileName" key={key}>{item}</span>
:
<a onClick={()=>this.returnUlr(`${key === 0 ? `${item}` :`${array[key-1]}/${item}`}`)} className="color-blue subFileName">{item}</a>
<a onClick={()=>this.returnUlr(`${getPathUrl(array,key+1)}`)} className="color-blue subFileName">{item}</a>
}
</React.Fragment>
);