我們在調用合約方法時,都可以傳一些參數的,比如轉賬金額 value。
value 的單位是 wei,這是一個很小的單位,所以一般數值很大。
注意,把 ether 轉 wei 需要先把 ether 的值轉成字符串,不然就會報出標題中的錯誤。
比如 0.1 ether 轉 wei 使用 web3.utils.toWei(this.inputEther.toString(), 'ether')。
反過來 wei 轉 ether 使用 web3.utils.fromWei(xx, 'ether')
另外,這里有一個相關的錯誤,https://www.cnblogs.com/farwish/p/12424108.html