- 使用uniapp 开发小程序 打包小程序uview的组件打包报错?
都是从git 上刚刚拉下来的,依赖都有装好, 同事的可以跑通,本人就不行, 小程序报错 没找到uview 的组件 但是组件是有的[图片] [图片]
2024-01-17 - ctx.draw(true, function () { 真机生成不了图片?
这段保存的代码在调试器里可以用,正常导出canvas变成图片,但是是真机安卓保存图片就没有触发ctx.draw() ,苹果触发了也是图片空白的情况,如果拿掉ctx.draw()回调的话那么wx.canvasToTempFilePath 保存的海报里的图片为空白的情况 saveImg() { // 按照设备比例去计算图片和画布尺寸 let bili = this.InfoSync.windowWidth / 375 * 1; const ctx = wx.createCanvasContext('posterCanvas'); let _this = this console.log('开始绘制-'); ctx.draw(true, function () { wx.canvasToTempFilePath({ x: 0, y: 0, width: 310 * bili, height: 435 * bili, destWidth: 310 * bili * _this.InfoSync.pixelRatio * 2, destHeight: 435 * bili * _this.InfoSync.pixelRatio * 2, fileType: "jpg", quality: 1, canvasId: "posterCanvas", success: function (res) { wx.hideLoading(); console.log('图片生成成功-', res.tempFilePath); var tempFilePath = res.tempFilePath; // 需要权限 wx.saveImageToPhotosAlbum({ filePath: tempFilePath, success(res) { wx.showModal({ content: "图片已保存到相册,赶紧晒一下吧~", showCancel: false, confirmText: "好的", confirmColor: "#333" }); }, fail: function (res) { wx.hideLoading(); wx.showToast({ title: "已取消", icon: "none", duration: 2000 }); } }); }, fail: err => { wx.hideLoading(); wx.showToast({ title: "出现了错误,请稍后再试", icon: "none" }); } }) }) },
2022-09-22 - 小程序的e.currentTarget.dataset 的值1 放到数组当下标报错 1 没定义?
[图片] <!--正面的框 --> <image src="https://www.chaochaotool.top:444/CQC/cow/01rice.png" mode="aspectFit" class="image-front" animation="{{animation[1]}}" bindtap='rotateFn' data-id="1"></image> <!--背面的框 --> <image src="https://www.chaochaotool.top:444/CQC/cow/11rice.png" mode="aspectFit" class="image-back" animation="{{animation_back[1]}}"></image> </view> <!-- 2 --> <view class="main1"> <image src="https://www.chaochaotool.top:444/CQC/cow/02happy.png" mode="aspectFit" class="image-front" animation="{{animation[2]}}" bindtap='rotateFn' data-id="2"></image> <!--背面的框 --> <image src="https://www.chaochaotool.top:444/CQC/cow/12happy.png" mode="aspectFit" class="image-back" animation="{{animation_back[2]}}" ></image> rotateFn(e) { var id = parseInt(e.currentTarget.dataset.id) this.setData({ id:id }) console.log("反转ID:"+id) var Temp="animationMain["+id+"]" console.log("hope数组为"+Temp) var backTemp="animationback["+id+"]" console.log("hope数组为"+backTemp) this.animation_main = wx.createAnimation({ duration:400, timingFunction:'linear' }) this.animation_back= wx.createAnimation({ duration:400, timingFunction:'linear', }) // 点击正面 this.animation[id].rotateY(180).step() this.animation_back[id].rotateY(0).step() this.setData({ //animationMain1: this.animation_main.export(), //animationBack1: this.animation_back.export(), // animationMain2: this.animation_main.export(), //animationBack2: this.animation_back.export(), // animationMain:[id]=this.animation[id].export(), //animation_back:[id]=this.animation_back[id].export(), [Temp]: this.animation_back.export(), [backTemp]:this.animation_back.export(), }) console.log("id值修改为:"+this.data.id) //} }, [图片]
2020-12-24