...ddEventListener("load", function() {
if (window.ethereum) {
// use MetaMask's provider
App.web3 = new Web3(window.ethereum);
window.ethereum.enable(); // get permission to access accounts
} else {
console.warn(
"No web3 detected. Falling back to http://127.0.0.1:85...
...ddEventListener("load", function() {
if (window.ethereum) {
// use MetaMask's provider
App.web3 = new Web3(window.ethereum);
window.ethereum.enable(); // get permission to access accounts
} else {
console.warn(
"No web3 detected. Falling back to http://127.0.0.1:8545...
...cted web3 instance is detected, fall back to Ganache
// 优先调用MetaMask提供的web3的实例
App.web3Provider = new Web3.providers.HttpProvider('http://localhost:8545');
}
web3 = new Web3(App.web3Provider);
return App.initContract();
},
initContract: func...
...accounts = res
})
console.log(window.ethereum)
console.log('MetaMask is installed!');
} else {
this.$message.error('This is an error message');
}
}
}
```
报错:Error: Transaction has been reverted by the EVM:
![image.png](https://img.learnblockchain.cn/atta...