Closed Francisundermoon closed 2 years ago
确认下当前钱包是不是 波场 钱包,以及 其他trx 应用你那里 能不能正常使用
确认下当前钱包是不是 波场 钱包,以及 其他trx 应用你那里 能不能正常使用
确定是在波场钱包下,在pc端tronlink和移动端bitkeep能正常拉起的页面响应,但是在tp钱包移动端直接失效了
有没有 测试链接 可以给我们测试下? 或者 代码片段之类的贴一下
<script>
new Vue({
el: "#hello",
data: function () {
return {
itemshow: false,
walletAddress: 2,
currentWalletTip: "",
}
},
mounted() {
// 判断钱包类型
if (window.tronWeb) {
this.tronWeb = window.tronWeb;
console.log(this.tronWeb)
tronLink.request({ method: 'tron_requestAccounts' })
this.walletAddress = this.tronWeb.defaultAddress.base58;
vant.Toast.success('当前为波场钱包');
this.walletAddress = 2
this.currentWalletTip="Tron"
}
console.log(this.walletAddress)
},
methods: {
testicon() {
this.itemshow = !this.itemshow
if (window.tronWeb) {
this.tronWeb = window.tronWeb;
console.log(this.tronWeb)
tronLink.request({ method: 'tron_requestAccounts' })
this.walletAddress = this.tronWeb.defaultAddress.base58;
vant.Toast.success('当前为波场钱包');
this.walletAddress = 2
this.currentWalletTip="Tron"
}
console.log(this.walletAddress)
}
}
})
</script>
这个,辛苦了
tp 里面 直接读 window.tronWeb.defaultAddress.base58 就可以了, 没有 tronLink.request({ method: 'tron_requestAccounts' }) 这个
tp 里面 直接读 window.tronWeb.defaultAddress.base58 就可以了, 没有 tronLink.request({ method: 'tron_requestAccounts' }) 这个
解决了,谢谢
波场钱包js在pc端可正常调用tronlink活动,但是在tp钱包移动端dapp浏览器一点反应都没有