uni-app 部分手机崩溃问题
uni-app 部分手机崩溃问题
| 产品分类 | 值 |
|---|---|
| 产品分类 | uniapp/App |
| PC开发环境操作系统 | Windows |
| PC开发环境操作系统版本号 | 10 |
| HBuilderX类型 | Alpha |
| HBuilderX版本号 | 3.3.11 |
| 手机系统 | Android |
| 手机系统版本号 | Android 10 |
| 手机厂商 | 华为 |
| 手机机型 | ALL |
| 页面类型 | vue |
| vue版本 | vue2 |
| 打包方式 | 云端 |
| 项目创建方式 | HBuilderX |
示例代码:
ctx = uni.createCanvasContext(this.id, this)
ctx.drawImage('/static/image/invitaion/postcard_default.png', 0, 0, this.width, this.height)
ctx.draw()
let width = this.width * 1.5
let positionY = 270
ctx.drawImage('/static/image/invitaion/poster_bottom.png', this.width / 2 - width / 2, positionY, width, this.height)
ctx.draw(true)
let logoWidth = 50;
ctx.drawImage('/static/image/logo.png', this.width / 2 - logoWidth / 2, positionY + 30, logoWidth, logoWidth)
ctx.draw(true)
ctx.setFontSize(10)
ctx.setTextAlign('center')
ctx.setFillStyle('#000000')
ctx.fillText('布丁影视', this.width / 2, positionY + 30 + 70)
let top = positionY + 30 + 70;
let startX = this.width / 2 - (this.qrcodeSize + this.margin * 2) / 2
let backgroundColor = '#ffffff'
let foregroundColor = '#000000'
ctx.drawImage('/static/image/invitaion/poster_qr_bg.png', startX, top, this.qrcodeSize + this.margin * 2, this.qrcodeSize + this.margin * 2)
for (var row = 0; row < this.modules.length; row++) {
for (var col = 0; col < this.modules.length; col++) {
var x = col * this.tileSize + this.margin
var y = row * this.tileSize + this.margin
var w = this.tileSize
var h = this.tileSize
var style = this.modules[row][col] ? foregroundColor : backgroundColor
ctx.setFillStyle(style)
ctx.fillRect(startX + x, top + y, w, h)
}
}
ctx.setFontSize(14)
ctx.setTextAlign('center')
ctx.setFillStyle('#000000')
ctx.fillText('邀请码:' + this.code + '(长按复制)', this.width / 2, positionY + 30 + 70 + 115)
ctx.draw(true)
ctx.save()
更多关于uni-app 部分手机崩溃问题的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复
