js截取文件后缀名

var fileName = this.file.name.lastIndexOf(".");//取到文件名开始到最后一个点的长度

var fileNameLength = this.file.name.length;//取到文件名长度

var fileFormat = this.file.name.substring(fileName + 1, fileNameLength);//截

console.log(fileFormat);

  

posted @ 2021-04-29 10:55  星空飘渺  阅读(1958)  评论(0编辑  收藏  举报