RENDER循环数组里边的对象



  • state = {
    data: { username: "", password: "" },
    errors: {},
    aarray: [
    { name: "kyle", birth: 1989 },
    {
    birth: 2015,
    name: "far",

        gender: ["unknonw", "female", "male", "animal"],
      },
    ],
    

    };

    render() {
    return (
    <div>

        <div>
          {this.state.aarray.map((array) => {
            return Object.entries(array).map(([key, value]) => (
              <div>
                <span>{key}: </span>
                {Array.isArray(value)
                  ? value.map((v) => <span key={v}>{v}</span>)
                  : value}
              </div>
            ));
          })}
        </div>
      </div>
    );
    

    }
    }
    如上代码在REACT里边可以正常REDNER。 TARO 报错:
    Module Error (from ./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js):
    找不到循环对应的名称



  • 遇到了类似的问题和报错,请问您解决了吗?


登录后回复