都2023了,这问题还存在
canvas 2d 报错 toTempFilePath:fail invalid viewid?模拟器没问题,真机一直报 toTempFilePath:fail invalid viewid? 业务是当前页面 需要点击进入别的页面填写内容,然后带参数返回 然后画海报保存 当前页面画直接画海报没问题,返回一直报 toTempFilePath:fail invalid viewid? onReady() { this.drawImage() }, drawImage: function () { let that = this const query = wx.createSelectorQuery() query.select('#myCanvas') .fields({ node: true, size: true }) .exec((res) => { const canvas = res[0].node const canvasRes = res[0] const ctx = canvas.getContext('2d') const dpr = wx.getSystemInfoSync().pixelRatio that.setData({ canvas , canvasRes, ctx, dpr }) }) }, drawImageDetail() { try { let userInfo = this.data.userInfo let canvasRes = this.data.canvasRes let canvas = this.data.canvas let dpr = this.data.dpr let ctx = this.data.ctx let that = this canvas.width = canvasRes.width * dpr canvas.height = canvasRes.height * dpr ctx.scale(dpr, dpr) ctx.fillStyle = 'white' ctx.fillRect(0, 0, canvas.width, canvas.height) ctx.font = '14px DINCondensed-Bold' ctx.fillStyle = '#BEC5CC' ctx.fillText(`生成海报`, 0, 0); setTimeout(() => { wx.canvasToTempFilePath({ canvas: canvas, success(res) { console.log(res.tempFilePath) }, fail(res){ console.log(res) } }) }, 400) } catch (error) { console.log(error) } },
2023-03-07自己定义了一个,解决了穿透和安卓上滚动的问题,代码地址是:https://github.com/prianyu/textarea,效果如下: [图片] [图片]
textarea 外使用滚动条,安卓端 输入内容随滚动条移动,ios可行[图片][图片]
2020-05-27实在是忍不住了,无论用cover-view还是设置fixed,都会引来额外的问题,于是自己自定义了一个,目前解决了的问题,组件已开源:https://github.com/prianyu/textarea [图片] [图片]
textarea的placeholder穿透问题?已解决具体查看:https://developers.weixin.qq.com/community/develop/article/doc/0004eea3024e7075653a30bb05ac13 textareaplaceholder 如图 页面上滑的时候textarea的placeholder会穿透过来 工具上面正常,真机会出现这样的问题 vivo NEX s 7.0.13 [图片] [图片]
2020-05-26