<canvas style='width:{
{canvasWidth}}px;height:{
{canvasHeight}}px' canvas-id='myCanvas'></canvas>
<button open-type='share'>分享</button>
【js部分】
var ctx = "" // 用于获取canvas
var leftMargin = "" //文字距离左边边距
var topMargin = "" //文字距离右边边距
Page({
/**
* 页面的初始数据
*/
data: {
title: '~~',
salary: '500-8000元/月',
rtype: '11',
rmoney: '20元',
canvasWidth: '', // canvas宽度
canvasHeight: '', // canvas高度
imagePath: '' // 分享的图片路径
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this
var sysInfo = wx.getSystemInfo({
success: function (res) {
that.setData({
//设置宽高为屏幕宽ÿ