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

网页制作网站首页苏州品牌网站设计企业

网页制作网站首页,苏州品牌网站设计企业,WordPress用户中心激活版,wordpress添加项目需求#xff1a;上面有几个按钮#xff0c;其中有一个切换是图片 用v-if会导致图片加载慢 实现方法#xff1a; 一进来就加载#xff0c;通过监听元素显示#xff0c;用于控制canvas的宽高#xff0c;从而达到隐藏的效果 组件dowolad.vue templateview …需求上面有几个按钮其中有一个切换是图片 用v-if会导致图片加载慢 实现方法 一进来就加载通过监听元素显示用于控制canvas的宽高从而达到隐藏的效果 组件dowolad.vue templateview stylemargin-top: 20rpx;canvas canvas-idmyCanvas :stylescaleObj/canvasbutton :loadingloading :disabledloading clicksaveImg classconfirmBnt v-if!weixin show保存二维码/button/view/templatescriptexport default {props: [show],data() {return {show: true,canvasId: myCanvas,imagePath: ,canvaseAttr:{width: 0,height: 0,},scaleObj:{},loading: false,weixin: false};},mounted(){this.weixin this.$wechat.isWeixin();this.init();},watch:{show:{handler(newData, oldData){let scale {width: 0,height: 0,}if(newData){scale.width this.canvaseAttr.widthpx;scale.height this.canvaseAttr.heightpx;}this.scaleObj scale;},deep: true,immediate: true}},methods: {init(){this.getImageInfo();},getImageInfo() {let that this;uni.getSystemInfo({success: (window) {const screenWidth window.windowWidth;uni.getImageInfo({src: https://media.sammu.top/pay_bank_img.png,success: (res) {let scale screenWidth/res.width;let height res.height*scale;that.canvaseAttr {width: screenWidth,height: height,}that.imagePath res.path;that.drawCanvas();},fail: (err) {console.log(err);}});},});},drawCanvas() {this.$nextTick((){const ctx uni.createCanvasContext(myCanvas, this);ctx.drawImage(this.imagePath, 0, 0, this.canvaseAttr.width, this.canvaseAttr.height);ctx.draw();})},saveImg(){const ctx uni.createCanvasContext(this.canvasId, this);let that this;that.loading true;// 绘制完成 ctx.draw(true, function () {uni.canvasToTempFilePath({canvasId: that.canvasId,success: (res) {// #ifdef H5that.saveH5Canvas(res)// #endif// #ifdef APPuni.saveImageToPhotosAlbum({filePath: res.tempFilePath,success: () {uni.showToast({title: 保存成功,icon: none})that.loading false;uni.hideLoading();},fail: () {uni.showToast({title: 保存失败,icon: none})that.loading false;uni.hideLoading();}});// #endif},fail: (err) {that.loading false;console.log(err, 错误信息);}});})},saveH5Canvas(res) {let that this;try {// 在 h5 中res.tempFilePath 返回的是 base64 类型要处理通过 a 标签的形式下载var arr res.tempFilePath.split(,);var bytes atob(arr[1]);let ab new ArrayBuffer(bytes.length);let ia new Uint8Array(ab);for (let i 0; i bytes.length; i) {ia[i] bytes.charCodeAt(i);}var blob new Blob([ab], {type: application/octet-stream});var url URL.createObjectURL(blob);var a document.createElement(a);a.href url;a.download new Date().valueOf() .png;var e document.createEvent(MouseEvents);e.initMouseEvent(click, true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);a.dispatchEvent(e);URL.revokeObjectURL(url);uni.showToast({title: 保存成功,icon: none})that.loading false;uni.hideLoading();} catch (e) {uni.showToast({title: 保存失败,icon: none})that.loading false;uni.hideLoading();} },},}/scriptstyle langscss scoped.confirmBnt{position: fixed;bottom: 20rpx;width: calc(100% - 20rpx);left: 50%;transform: translateX(-50%);background: var(--view-theme);border-radius: 24rpx;height: 108rpx;line-height: 108rpx;font-size: 40rpx;font-weight: 700;text-align: center;color: #fff;}/style 调用 dowload refdowloadRef :showactive 1/dowload
http://www.hkea.cn/news/14470431/

相关文章:

  • 肥西网站建设wordpress的站点是什么
  • 北京微网站app在线设计公司
  • 为网站添加统计成都美食网站设计论文
  • 网站登录模版 下载网站建设方案规划书
  • 网站设计主要内容网站知识介绍
  • 上传文件网站根目录wordpress媒体库配置
  • 网站域名注册商标适合农村的代加工厂
  • 专业律所网站建设企业官网维护
  • 娱乐建网站做网站用什么比较好
  • 做网站总结作文Wordpress怎么改成中文
  • 在家做网站设计怎样做公司网站推广
  • 个人网站备案需要哪些做网站全包
  • 户外产品销售公司网站建设如何制作图片配文字
  • 做的网站如何发布会黄埔网站开发
  • 攀枝花三线建设网站网站建设调查通知
  • 做原创视频网站淘宝网上购物商城
  • 织梦如何一个后台做两个网站可以做科学模拟实验的网站
  • 承接网站开发 app开发wordpress 破解主题
  • 电站建设招聘网站网站论坛源码
  • 自建网站营销是什么意思wordpress百度站长验证
  • 支付宝网站接口申请美食网站建设目的
  • 建设银行春招报名网站图片搜集网站怎么做
  • 做毕设的网站企业网站建设选题依据
  • 凡科网站免费注册游戏app软件定制开发
  • 怎么做网站主wordpress 写插件吗
  • 程序员都需要学什么河南网站seo营销多少费用
  • 建网站费用 优帮云公司模板建站
  • 网站开发实习媒体营销平台
  • 智慧团建官方网站私密浏览器在线观看
  • 韶关市建设与房地产信息网站百度应用下载安装