App.contracts.TodoList上的错误= TruffleContract(todoList)

问题描述 投票:0回答:1

在Windows 10环境下工作

Windows 10上的Web服务器错误:

'''

Failed to load resource: the server responded with a status of 404 (Not Found)

    app.js:56 Uncaught (in promise) ReferenceError: TruffleContract is not defined

    at Object.loadContract (app.js:56)

    at async Object.load (app.js:8)

'''

错误引用的代码:

'''
      loadContract: async () => {
        //var contract = require("truffle-contract");
        // Create a JavaScript version of the smart contract
        const todoList = await $.getJSON('vote.json')
        console.log(todoList)
        App.contracts.TodoList = TruffleContract(todoList)
        App.contracts.TodoList.setProvider(App.web3Provider)

        // Hydrate the smart contract with values from the blockchain
        App.todoList = await App.contracts.TodoList.deployed()
      },
'''
truffle
1个回答
0
投票

已解决已添加var contract = required("truffle-contract");

© www.soinside.com 2019 - 2024. All rights reserved.