- wx.canvasToTempFilePath报错,提示image格式错误?
基础库版本:2.16.1 报错内容: VM1309 WAService.js:2 TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' 代码段: // 创建离屏 2D canvas 实例 const canvas = wx.createOffscreenCanvas({type: '2d', width: 300, height: 150}) // 获取 context。注意这里必须要与创建时的 type 一致 const context = canvas.getContext('2d') // 创建一个图片 const image = canvas.createImage() // 等待图片加载 await new Promise(resolve => { image.onload = resolve image.src = 'http://1812.img.pp.sohu.com.cn/images/blog/2009/11/18/18/8/125b6560a6ag214.jpg' // 要加载的图片 url }) // 把图片画到离屏 canvas 上 context.clearRect(0, 0, 300, 150) context.drawImage(image, 0, 0, 300, 150) wx.canvasToTempFilePath({ canvas: canvas, quality: 1, success: (res) => { let filePath = res.tempFilePath; //获取图片地址 console.log("filePath:",filePath) } }, this)
2021-05-23 - OffscreenCanvas如何保存到图片呢?
如题,OffscreenCanvas如何保存到图片呢?
2020-03-03 - createOffscreenCanvas 生成的canvas实例无法保存至本地?
const canvas = wx.createOffscreenCanvas({type: '2d', width: 750, height: 1334}) wx.canvasToTempFilePath({ canvas: canvas, success: (resss) => { }, fail: function(err) { console.log(err) } }) 报错: TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' 开发工具, 调试基础库 2.17.0
2021-05-01 - 通过小程序蓝牙接口进行OTA升级速度太慢
- 需求的场景描述(希望解决的问题) 通过小程序蓝牙接口进行OTA升级速度太慢 writeBLECharacteristicValue一次只能写入20个字节,用这个接口写入数据,速度只有不到0.5KB/s,一个1.8MB的OTA包,需要1个多小时才能下载到蓝牙设备。 - 希望提供的能力 希望能够将这个接口一次能写入多一些数据,最好能到512个字节
2018-05-14 - canvasToTempFilePath()安卓机根本不运行也不报错
var _this = this; var children = _this.selectComponent("#mapView"); children.canvasToTempFilePath({ x: 0, y: 0, destWidth: 500, destHeight: 500, success: function (param) { _this.setData({ mapImg: param.tempFilePath }) } } wx.canvasToTempFilePath(opt, _this); .canvasToTempFilePath()安卓机根本不运行也不报错 canvasToTempFilePath()安卓机根本不运行也不报错
2018-08-13 - movable-view动态修改direction没效果
[代码]<[代码][代码]movable-view[代码] [代码]x[代码][代码]=[代码][代码]"50"[代码] [代码]y[代码][代码]=[代码][代码]"50"[代码] [代码]style[代码][代码]=[代码][代码]"width:400rpx;height:400rpx;"[代码] [代码]direction[代码][代码]=[代码][代码]"{{moveOn?'none':'all'}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"move"[代码] [代码]catchtouchstart[代码][代码]=[代码][代码]"moveS"[代码] [代码]catchtouchend[代码][代码]=[代码][代码]"moveE"[代码][代码]></[代码][代码]view[代码][代码]>[代码][代码]</[代码][代码]movable-view[代码][代码]>[代码][代码]moveS:[代码][代码]function[代码][代码](){[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]moveOn:[代码][代码]true[代码][代码] [代码][代码]});[代码][代码]},[代码][代码]moveE:[代码][代码]function[代码][代码](){[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]moveOn:[代码][代码]false[代码][代码] [代码][代码]});[代码][代码]},[代码] 当 direction为none时 还是可以移动
2017-08-29