方法1.通过断点js 获取到下载的url
点击下载按钮会触发这个事件.
1 rightListBtnFn: function(t) { 2 var e = this; 3 zhuge.track("cv_click_template_download", { 4 tid: this.templateID, 5 is_unlock: 1 == this.templateData.resume_info.is_lock ? 0 : 1, 6 language: "1" == this.templateData.resume_info.i18n_id ? 1 : 2, 7 type_id: t 8 }), 9 this.templateData.resume_info.is_lock ? this.unlockFn() : 1 == t ? (this.showEmail = !0, 10 this.emailValue = this.templateData.resume_info.email) : this.is_download || (this.is_download = !0, 11 this.$http.get(l.logTemplateDown, { 12 params: { 13 resume_id: this.templateData.resume_info.id 14 } 15 }).then(function(t) { 16 e.is_download = !1, 17 1 == t.status ? (window.location.href = t.data.pdf_file_url, 18 e.showDownload = !0) : alert(t.msg) 19 })) 20 }
1 //这个就是下载url 2 this.templateData.resume_info.pdf_file_url
方法2:
使用控制台
1 //查看html 找到canvas id, 有几页就又几个 2 <canvas id="page1" width="794" height="1123" style=" 794px; height: 1123px;"></canvas>
1 var oCanvas=document.getElementById("page1");var strDataURI = oCanvas.toDataURL();console.log(strDataURI); var a=document.createElement("a");a.href=strDataURI;a.download="page1";a.click();
以上代码都是原理,可以进一步优化.实现全自动.