获取文件的后缀名(转为数组) 字符串和变量的拼接 HTML中字符串和变量的拼接

1文件上传时,获取文件的后缀名###

var cont="2010-23.23.xls"
console.log(cont.split("."));//split将字符串变为数组哈
var arr=cont.split(".");
console.log(arr[arr.length-1])

2字符串和变量的拼接###

字符串和变量的拼接 直接使用模板字符串就可以了
 xhr.open('post', `${this.basefileupload}/base/api/userInfo/teacherInfo/importExcel`, true);

在HTML中字符串和变量的拼接

动态绑定:href值
 <a
 :href="`${basefileupload}/base/api/userInfo/studentInfo/downloadExcelTemplate?orgId= ${parentId}`"
 >下载模板</a>

在HTML中的拼接和在js区域下拼接的不同###

在HTML中的拼接: 外层必须使用双引号,里面紧挨着使用es6的模板字符串
js中的拼接:里层直接使用模板字符串。
posted @ 2020-02-15 14:34  南风晚来晚相识  阅读(699)  评论(0编辑  收藏  举报