四十一、下载附件

//文档下载
			startDownLoad(metarId, taskId, smsId, stsId) {
				var params = {
					id: metarId,
					taskId: taskId,
					smsId: smsId,
					stsId: stsId,
				}
				//var json = JSON.stringify(params);
				//下载附件
				let urlStr = window.location.href;
				if(urlStr.indexOf("index.html") != -1) {
					var href = window.location.href.substring(0, window.location.href.indexOf("index.html")) + "myCourses/downDocFile?id=" + metarId + "&taskId=" + taskId + "&smsId=" + smsId + "&stsId=" + stsId;
					window.open(href);
				} else {
					var url = window.location.href.substring(0, window.location.href.indexOf("index.html")) + "myCourses/downDocFile?id=" + metarId + "&taskId=" + taskId + "&smsId=" + smsId + "&stsId=" + stsId;
					window.open(url);
				}
			},

  

原文地址:https://www.cnblogs.com/deng-jie/p/10789358.html