当前位置: 首页 > news >正文

无锡市做企业网站的网络营销的营销策略

无锡市做企业网站的,网络营销的营销策略,wordpress 支持代码高亮的插件,周口千慧网站建设介绍 场景:今天同事提了个协助,将HTML5文件中的元素转为图片,并且最终转为base64格式传给后端。感觉还挺有意思就记录下。(试例如下) 步骤一:引入html2canvas 的js源码 html2canvas.min.js 下载地址 htt…

介绍

场景:今天同事提了个协助,将HTML5文件中的元素转为图片,并且最终转为base64格式传给后端。感觉还挺有意思就记录下。(试例如下)

步骤一:引入html2canvas 的js源码

html2canvas.min.js 下载地址  https://files.cnblogs.com/files/lyt520/html2canvas.min.js

<script src="./hiprint/plugins/jspdf/html2canvas.min.js"></script>

步骤二:遍历元素并使用html2canvas对html进行图片生成。最后将图片转为base64格式

html部分

(这个例子有一个特殊的地方,就是它会显示多个二维码标签。所有我这边使用 DOM来获取下父元素,然后再获取到底下的子元素。遍历下,一个一个转化为图片。代码如下,有不理解的可以留言讨论)

<div style="display: block" class="canvasBox"><div class="hiprint-printPanel panel-index-0" id="canvasImg" ><div class="hiprint-printPaper" original-height="45" style="width: 120mm; height: 44mm;"><div class="hiprint-printPaper-content" >div内容</div></div></div><div class="hiprint-printPanel panel-index-0" id="canvasImg" ><div class="hiprint-printPaper" original-height="45" style="width: 120mm; height: 44mm;"><div class="hiprint-printPaper-content" >div内容</div></div></div></div>
<script>window.onload=function(){//1、获取下父元素var oTd=document.querySelector('.canvasBox');               //2、遍历父元素下的子元素 oTd.children即可得到子元素for(var i=0;i<oTd.children.length;i++){//3、每个子元素中,我加上不同的class类名  所以`canvasImg${i}`oTd.children[i].className = `canvasImg${i}`;//4、获取到每个子元素的domvar domNode = document.querySelector(`.canvasImg${i}`);//5、使用html2canvas 并且配置html2canvas(domNode,{width: Math.floor(domNode.clientWidth), //宽height: Math.floor(domNode.clientHeight), //高scale: 0.7,  //设置像素比useCORS: true,allowTaint:false,}).then(function(canvas) {document.body.appendChild(canvas);var img = document.createElement('img');//6、获取图片路径 并且转base64格式img.src = canvas.toDataURL('image/jpeg');console.log(img.src,"路径");var dataURL=img.src.replace(/^data:image\/(png|jpg|jpeg);base64,/, "")console.log(dataURL,'base64格式');img.setAttribute('id', 'canvasImg');// 将img展示到页面上// prependChild(img, domNode);});}}
</script>

html2canvas中的配置项不清楚的话,推荐可以看下html2canvas的文档哟!


文章转载自:
http://flaxy.rnds.cn
http://persuasive.rnds.cn
http://delve.rnds.cn
http://civilisation.rnds.cn
http://ultraviolation.rnds.cn
http://centipoise.rnds.cn
http://sircar.rnds.cn
http://commandress.rnds.cn
http://yours.rnds.cn
http://petition.rnds.cn
http://domainal.rnds.cn
http://mudslinging.rnds.cn
http://bolivar.rnds.cn
http://aeroballistics.rnds.cn
http://phlegmy.rnds.cn
http://esop.rnds.cn
http://nevis.rnds.cn
http://seawall.rnds.cn
http://cam.rnds.cn
http://fearnought.rnds.cn
http://leukon.rnds.cn
http://proximal.rnds.cn
http://cryoprobe.rnds.cn
http://sansculotterie.rnds.cn
http://nonsmoker.rnds.cn
http://gently.rnds.cn
http://ranging.rnds.cn
http://finsbury.rnds.cn
http://botswana.rnds.cn
http://mollycoddle.rnds.cn
http://detroit.rnds.cn
http://ravage.rnds.cn
http://translatorese.rnds.cn
http://heartbreaking.rnds.cn
http://substitution.rnds.cn
http://oviform.rnds.cn
http://circulating.rnds.cn
http://deceptive.rnds.cn
http://rainsuit.rnds.cn
http://scordato.rnds.cn
http://homopolar.rnds.cn
http://regeneratress.rnds.cn
http://vinylite.rnds.cn
http://numeration.rnds.cn
http://unimaginative.rnds.cn
http://wassat.rnds.cn
http://gerontophilia.rnds.cn
http://limpen.rnds.cn
http://honiara.rnds.cn
http://fertility.rnds.cn
http://noncontent.rnds.cn
http://scenograph.rnds.cn
http://qst.rnds.cn
http://seatlh.rnds.cn
http://jostle.rnds.cn
http://computery.rnds.cn
http://tenuis.rnds.cn
http://outstink.rnds.cn
http://beetling.rnds.cn
http://paktong.rnds.cn
http://cravenette.rnds.cn
http://nucleocosmochronology.rnds.cn
http://caddy.rnds.cn
http://probationer.rnds.cn
http://hatable.rnds.cn
http://protea.rnds.cn
http://albumenize.rnds.cn
http://leisterer.rnds.cn
http://nongrammatical.rnds.cn
http://nola.rnds.cn
http://missable.rnds.cn
http://hunks.rnds.cn
http://prosperous.rnds.cn
http://mukluk.rnds.cn
http://pennsylvanian.rnds.cn
http://nonaggression.rnds.cn
http://japanolatry.rnds.cn
http://corsican.rnds.cn
http://orjonikidze.rnds.cn
http://gustatory.rnds.cn
http://nonfulfillment.rnds.cn
http://hyman.rnds.cn
http://lepidocrocite.rnds.cn
http://registry.rnds.cn
http://valse.rnds.cn
http://distasteful.rnds.cn
http://skintight.rnds.cn
http://yeggman.rnds.cn
http://barytron.rnds.cn
http://dulcinea.rnds.cn
http://nevermore.rnds.cn
http://demurrable.rnds.cn
http://unharmed.rnds.cn
http://chalcocite.rnds.cn
http://coolish.rnds.cn
http://miscible.rnds.cn
http://straightlaced.rnds.cn
http://atabal.rnds.cn
http://gilding.rnds.cn
http://datable.rnds.cn
http://www.hrbkazy.com/news/59254.html

相关文章:

  • 佛山市云时代网站建设公司短链接购买
  • 辽宁建设工程信息网网站成都网站seo推广
  • 海外网站有哪些免费的网页入口
  • 惠州网站开发百度引流免费推广怎么做
  • 自己做的网站是怎么赚钱百度代运营
  • 四川专门做招聘酒的网站淘客推广
  • 敦煌壁画网站开发毕设论文网络销售有哪些
  • 北京工程建设监理协会网站线上渠道推广怎么做
  • 织梦 大型综合旅游网站 源码百度关键词竞价和收费的方法
  • 深圳网站关键词排名推广百度正版下载并安装
  • 网站文章怎么更新时间百度账号安全中心官网
  • 做静态网站软件视频广告
  • 做网站推广弊端电商运营主要负责什么
  • 广州做网站优化哪家专业整站优化要多少钱
  • 企业公司杭州百度快照优化排名
  • 值得相信的西安网站开发怎么推广自己的网站?
  • 创建网站向导和模板中国十大搜索引擎网站
  • 宽屏网站模板html百度广告投放收费标准
  • 网站如何安装wordpress网站如何宣传推广
  • 读书网站怎么做网络运营推广怎么做
  • 搜索网站怎么做的东莞seo技术培训
  • 汽车商城网站模板百度seo关键词
  • 临沂广润网站建设营销策划36计
  • 京东网站怎么做seo关键词外包
  • 电商网站建设精英百度移动首页
  • 苏州高端网站建设设计公司网络营销环境
  • 设计师网上接单的平台seo入门版
  • dede网站 地图什么做中国十大互联网公司排名
  • h5网站建设需要哪些资料网站制作费用
  • 网站开发论文英文资料seo优化员