//连接phantom钱包 async connectWallet(){ // console.log('"window.solana.isPhantom :',window.solana.isPhantom); try { //{ onlyIfTrusted: true }是 onlyIfTrusted 的参数,可以去掉 const resp = await window.solana.connect(); resp.publicKey.toString(); //连接了solana钱包,得到了钱包地址 console.log('resp.publicKey.toString() :',resp.publicKey.toString()); this.getTokenByAccount(resp.publicKey.toString()); } catch (err) { console.log('connectWallet err :',err); } }