game.js
import ‘./js/libs/weapp-adapter’
console.log(canvas.width, canvas.height)
var context = canvas.getContext(‘2d’)
var image = wx.createImage()
image.onload = function () {
context.drawImage(image, 100, 100)
}
let button = wx.createUserInfoButton({
type: ‘text’,
text: ‘登录’,
withCredentials:false,
style: {
left: 80,
top: 500,
width: 200,
height: 40,
lineHeight: 40,
backgroundColor: ‘#ff00aa’,
color: ‘#ffffff’,
textAlign: ‘center’,
fontSize: 16,
borderRadius: 4
}
})
button.onTap((res) => {
console.log(res)
var imageUrl = res.userInfo.avatarUrl
image.src = imageUrl
})