问题描述
我已经成功部署并迁移了我的合同和连接元掩码到 ganache,但是在我的浏览器控制台上我得到了这个错误: 类型错误:无法读取未定义的属性“调用”
我使用的是 Truffle v5.3.11 和 Web3 1.0.0-beta.49,这是我在 app.js 文件中得到错误的地方。
fetchItemBufferOne: function () {
App.upc = $("#upc").val();
App.contracts.SupplyChain.deployed()
.then(function (instance) {
return instance.fetchItemBufferOne(App.upc);
})
.then(function (result) {
$("#ftc-item").text(result);
console.log("fetchItemBufferOne",result);
})
.catch(function (err) {
console.log(err.message);
});
}
fetchItemBufferTwo: function () {
/// event.preventDefault();
/// var processId = parseInt($(event.target).data('id'));
App.upc = $('#upc').val();
App.contracts.SupplyChain.deployed().then(function (instance) {
return instance.fetchItemBufferTwo.call(App.upc);
}).then(function (result) {
$("#ftc-item").text(result);
console.log('fetchItemBufferTwo',result);
}).catch(function (err) {
console.log(err.message);
});
},fetchEvents: function () {
if (typeof App.contracts.SupplyChain.currentProvider.sendAsync !== "function") {
App.contracts.SupplyChain.currentProvider.sendAsync = function () {
return App.contracts.SupplyChain.currentProvider.send.apply(
App.contracts.SupplyChain.currentProvider,arguments
);
};
}
App.contracts.SupplyChain.deployed().then(function (instance) {
var events = instance.allEvents(function (err,log) {
if (!err)
$("#ftc-events").append('<li>' + log.event + ' - ' + log.transactionHash + '</li>');
});
}).catch(function (err) {
console.log(err.message);
});
} };
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)