app.615a4834.js 9.1 KB

12
  1. (function(t){function e(e){for(var r,o,s=e[0],c=e[1],l=e[2],d=0,p=[];d<s.length;d++)o=s[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(t[r]=c[r]);u&&u(e);while(p.length)p.shift()();return i.push.apply(i,l||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i[e],r=!0,s=1;s<n.length;s++){var c=n[s];0!==a[c]&&(r=!1)}r&&(i.splice(e--,1),t=o(o.s=n[0]))}return t}var r={},a={app:0},i=[];function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var l=0;l<s.length;l++)e(s[l]);var u=c;i.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"034f":function(t,e,n){"use strict";var r=n("6093"),a=n.n(r);a.a},"56d7":function(t,e,n){"use strict";n.r(e);n("e44b"),n("6648"),n("5f54"),n("f0e6");var r=n("0261"),a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("button",{directives:[{name:"print",rawName:"v-print",value:t.printObj,expression:"printObj"}]},[t._v("Print the entire page")]),n("div",{staticStyle:{background:"#60aebf"},attrs:{id:"printMe"}},[n("div",{ref:"qrcode"}),n("div",{ref:"echartMain",style:{width:"300px",height:"300px"}}),n("input",{attrs:{type:"number"}}),n("input",{attrs:{type:"time"}}),n("input",{attrs:{type:"checkbox"}}),n("input",{attrs:{type:"radio"}}),t._m(0),t._m(1),n("textarea",{attrs:{name:"",id:"",cols:"30",rows:"10"}}),n("p",[t._v("葫芦娃,葫芦娃")]),n("p",{staticStyle:{background:"yellow"}},[t._v("一根藤上七朵花 ")]),n("p",[t._v("小小树藤是我家 啦啦啦啦 ")]),n("p",[t._v("叮当当咚咚当当 浇不大")]),n("p",[t._v(" 叮当当咚咚当当 是我家")]),n("p",[t._v(" 啦啦啦啦")]),n("p",[t._v("...")])])])},i=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("select",[n("option",{attrs:{value:"volvo"}},[t._v("Volvo")]),n("option",{attrs:{value:"saab"}},[t._v("Saab")]),n("option",{attrs:{value:"mercedes"}},[t._v("Mercedes")]),n("option",{attrs:{value:"audi"}},[t._v("Audi")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("select",[n("option",{attrs:{value:"volvo"}},[t._v("Volvo")]),n("option",{attrs:{value:"saab"}},[t._v("Saab")]),n("option",{attrs:{value:"mercedes"}},[t._v("Mercedes")]),n("option",{attrs:{value:"audi"}},[t._v("Audi")])])}],o=n("1f57"),s=n.n(o),c=n("5c3d"),l=n.n(c),u={name:"app",data:function(){return{printObj:{id:"printMe",popTitle:"good print",extraCss:"https://www.baidu.com/,https://www.baidu.com/",extraHead:'<meta http-equiv="Content-Language"content="zh-cn"/>'}}},mounted:function(){var t=this;this.echart(),this.$nextTick((function(){new s.a(t.$refs.qrcode,{width:100,height:100,text:"https://www.baidu.com/"})}))},methods:{echart:function(){var t=l.a.init(this.$refs.echartMain);t.setOption({title:{text:"ECharts 入门示例"},tooltip:{},xAxis:{data:["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]},yAxis:{},series:[{name:"销量",type:"bar",data:[5,20,36,10,10,20]}]})}}},d=u,p=(n("034f"),n("b0a0"),n("5511")),h=Object(p["a"])(d,a,i,!1,null,null,null),v=h.exports,f=(n("9dd9"),n("f548"),n("684c")),g=(n("6d57"),n("8e0d")),y=n("4317"),m=function(){function t(e){Object(g["a"])(this,t),this.standards={strict:"strict",loose:"loose",html5:"html5"},this.selectArray=[],this.counter=0,this.settings={standard:this.standards.html5,extraHead:"",extraCss:"",popTitle:"",endCallback:null,ids:""},Object.assign(this.settings,e),this.init()}return Object(y["a"])(t,[{key:"init",value:function(){this.counter++,this.settings.id="printArea_".concat(this.counter);var t=this.getPrintWindow();this.write(t.doc),this.print(t),this.settings.endCallback()}},{key:"print",value:function(t){var e=this,n=t.win,r=function(){n.focus(),n.print();try{var t=document.getElementById(e.settings.id),r=e.elsdom.querySelectorAll(".canvasImg");console.log(e.elsdom);for(var a=0;a<r.length;a++){var i=r[a].parentNode;i.removeChild(r[a])}t.parentNode.removeChild(t)}catch(o){console.log(o)}};if(window.ActiveXObject)return n.onload=r(),!1;n.onload=function(){r()}}},{key:"write",value:function(t,e){t.open(),t.write("".concat(this.docType(),"<html>").concat(this.getHead()).concat(this.getBody(),"</html>")),t.close()}},{key:"docType",value:function(){if(this.settings.standard===this.standards.html5)return"<!DOCTYPE html>";var t=this.settings.standard===this.standards.loose?" Transitional":"",e=this.settings.standard===this.standards.loose?"loose":"strict";return'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01'.concat(t,'//EN" "http://www.w3.org/TR/html4/').concat(e,'.dtd">')}},{key:"getHead",value:function(){var t="",e="",n="";this.settings.extraHead&&this.settings.extraHead.replace(/([^,]+)/g,(function(e){t+=e})),[].forEach.call(document.querySelectorAll("link"),(function(t,n){t.href.indexOf(".css")>=0&&(e+='<link type="text/css" rel="stylesheet" href="'.concat(t.href,'" >'))}));var r=document.styleSheets;if(r&&r.length>0)for(var a=0;a<r.length;a++)try{if(r[a].cssRules||r[a].rules)for(var i=r[a].cssRules||r[a].rules,o=0;o<i.length;o++)n+=i[o].cssText}catch(s){console.log(r[a].href+s)}return this.settings.extraCss&&this.settings.extraCss.replace(/([^,\s]+)/g,(function(t){e+='<link type="text/css" rel="stylesheet" href="'.concat(t,'">')})),"<head><title>".concat(this.settings.popTitle,"</title>").concat(t).concat(e,'<style type="text/css">').concat(n,"</style></head>")}},{key:"getBody",value:function(){var t=this.settings.ids;t=t.replace(new RegExp("#","g"),""),this.elsdom=this.beforeHanler(document.getElementById(t));var e=this.getFormData(this.elsdom),n=e.outerHTML;return"<body>"+n+"</body>"}},{key:"beforeHanler",value:function(t){for(var e=t.querySelectorAll("canvas"),n=0;n<e.length;n++)if(!e[n].style.display){var r=e[n].parentNode,a=e[n].toDataURL("image/png"),i=new Image;i.className="canvasImg",i.style.display="none",i.src=a,r.appendChild(i)}return t}},{key:"getFormData",value:function(t){for(var e=t.cloneNode(!0),n=e.querySelectorAll("input,select,textarea"),r=e.querySelectorAll(".canvasImg,canvas"),a=-1,i=0;i<r.length;i++){var o=r[i].parentNode,s=r[i];"canvas"===s.tagName.toLowerCase()?o.removeChild(s):s.style.display="block"}for(var c=0;c<n.length;c++){var l=n[c],u=l.getAttribute("type"),d=n[c];if(u||(u="SELECT"===l.tagName?"select":"TEXTAREA"===l.tagName?"textarea":""),"INPUT"===l.tagName)"radio"===u||"checkbox"===u?d.setAttribute("checked",l.checked):(d.value=l.value,d.setAttribute("value",l.value));else if("select"===u){a++;for(var p=0;p<t.querySelectorAll("select").length;p++){var h=t.querySelectorAll("select")[p];if(!h.getAttribute("newbs")&&h.setAttribute("newbs",p),h.getAttribute("newbs")==a){var v=t.querySelectorAll("select")[a].selectedIndex;l.options[v].setAttribute("selected",!0)}}}else d.innerHTML=l.value,d.setAttribute("html",l.value)}return e}},{key:"getPrintWindow",value:function(){var t=this.Iframe();return{f:t,win:t.contentWindow||t,doc:t.doc}}},{key:"Iframe",value:function(){var t,e=this.settings.id,n=this;try{t=document.createElement("iframe"),document.body.appendChild(t),t.style.border="0px",t.style.position="absolute",t.style.width="0px",t.style.height="0px",t.style.right="0px",t.style.top="0px",t.setAttribute("id",e),t.setAttribute("src",(new Date).getTime()),t.doc=null,t.doc=t.contentDocument?t.contentDocument:t.contentWindow?t.contentWindow.document:t.document,t.onload=function(){var e=t.contentWindow||t;n.print(e)}}catch(r){throw new Error(r+". iframes may not be supported in this browser.")}if(null==t.doc)throw new Error("Cannot find document.");return t}}]),t}(),b={directiveName:"print",bind:function(t,e,n){var r=n.context,a=!0,i="";t.addEventListener("click",(function(){r.$nextTick((function(){if("string"===typeof e.value)i=e.value;else if("object"===Object(f["a"])(e.value)&&e.value.id){i=e.value.id;var t=i.replace(new RegExp("#","g"),""),n=document.getElementById(t);n||(console.log("id in Error"),i="")}i?o():window.print()}))}));var o=function(){a&&(a=!1,new m({ids:i,standard:"",extraHead:e.value.extraHead,extraCss:e.value.extraCss,popTitle:e.value.popTitle,endCallback:function(){a=!0}}))}},install:function(t){t.directive("print",b)}},w=b;r["a"].config.productionTip=!1,r["a"].use(w),new r["a"]({render:function(t){return t(v)}}).$mount("#app")},6093:function(t,e,n){},ad63:function(t,e,n){},b0a0:function(t,e,n){"use strict";var r=n("ad63"),a=n.n(r);a.a}});
  2. //# sourceMappingURL=app.615a4834.js.map