javascript - 变量的值未正确作为参数传递给方法
问题描述
我正在声明一个变量“account”(分配了 accounts[0] 的值),我试图将其用作调用“this.login”方法的参数(“this.account”)。变量的值未正确传递。但是,如果我使用“accounts”变量作为参数传递,它就可以工作。
data () {
return {
account: null
}
}
this.web3.eth.getAccounts().then((accounts) => {
this.account = accounts[0]
if ((!sessionStorage) || (session === '')) {
this.login(this.account)
}
})
我不太明白为什么我不能成功使用“this.account”变量作为调用this.login方法的参数。
解决方案
推荐阅读
- api - 当我通过 /crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb) 作为“路径”属性来获取函数时,它会被 url 编码
- google-chrome-extension - 我想知道根据弹出结果改变谷歌扩展图标的程序代码
- microsoft-graph-api - 无法在 Graph 中搜索网站
- google-cloud-platform - Cloud Firestore 的审核日志包括删除集合?
- python - 站点可以通过其他站点上的 iframe 检测机器人吗?
- python - 我如何将 kepler.gl 与 Django 后端一起使用
- python - 无法在 VS 代码中读取文本文件(Python)
- jquery - jQuery:在父级中选择具有类名的内部和外部第一个元素
- angular - 角度测试 routerLinkActive 不起作用
- java - 您如何检测是否显示此弹出窗口