# 修改小程序wxml-to-canvas **Repository Path**: long-dahui/modify-wxml-to-canvas ## Basic Information - **Project Name**: 修改小程序wxml-to-canvas - **Description**: 扩展wxml-to-canvas - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-03 - **Last Updated**: 2024-02-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 修改小程序wxml-to-canvas #### 修改点: ```js async renderToCanvas(args) { ... this.boundary = { top: container.layoutBox.top, left: container.layoutBox.left, width: container.layoutBox.width, // 由computedStyle改成layoutBox height: container.layoutBox.height // 由computedStyle改成layoutBox } ... }, ``` #### 修改点: ```js drawText(text, box, style) { ... let { color = '#000', lineHeight = '1.4em', fontSize = 14, fontWeight = 'normal',// 增加 textAlign = 'left', verticalAlign = 'top', backgroundColor = 'transparent' } = style ... ctx.textBaseline = 'top' ctx.font = `${fontWeight} ${fontSize}px sans-serif` // 修改 ctx.textAlign = textAlign ... } ```