a标签在IE浏览器进行download下载,出现中文乱码 - 戴向天

大家好!我叫戴向天

QQ群:602504799

如若有不理解的,可加QQ群进行咨询了解

function getEncodeUrl(url = ''){
	return url.split('/').map((str)=>/[\u4e00-\u9fa5]+/g.test(str)?encodeURI(str):str).join('/')
}

use method:
getEncodeUrl('http://www.yangchan.com/文件夹/压缩包/test.zip')

Vue file:
<a :href="getEncodeUrl('http://www.yangchan.com/文件夹/压缩包/test.zip')"></a>

猜你喜欢

转载自blog.csdn.net/weixin_41088946/article/details/112313905