您的意思是,其实直接写一个方法,像下面
function wxAPI() {
var button = wx.createUserInfoButton({
type: ‘text’,
text: ‘获取用户信息’,
style: {
left: 10,
top: 76,
width: 200,
height: 40,
lineHeight: 40,
backgroundColor: ‘#ff0000’,
color: ‘#ffffff’,
textAlign: ‘center’,
fontSize: 16,
borderRadius: 4
}
})
button.onTap(function(res) {
console.log(res)
})
}
我就在 onLoad 里面调用,但是出来的是
请问我是不是误解了呢,谢谢您的回复啊