在另一张地图中拼接的地图

我正在尝试在另一张地图中制作一张地图,但它似乎与我的要求相反。我想模仿每个地图彼此相邻,例如:


A = B

A.1 = B.1

A.2 = B.2 

等等,但是,我得到了


A = B 

A = B.1 

A = B.2

A.1 = B

A.1 = B.1

A.1 = B.2

等等..这是我的代码:


  {titles.map((t, index) => (

    <tr>

      {console.log(this.state)}

      <td key={index}>{t.toString() + " : "}</td>

      <td>{this.state.files.map((x, index) => (

            <div key={index} style={{color:'#01579b', cursor: 'pointer', border: '1px ridge'}} 

              key={`link${index}`} 

              onClick={this.downloadFile.bind(null,x)}>{x.original_name}

            </div>                   

            ))}

      </td>   

    </tr>

  ))}


明月笑刀无情
浏览 94回答 1
1回答

胡说叔叔

{titles.map((t, index) => (&nbsp; &nbsp; <tr>&nbsp; &nbsp; &nbsp; {console.log(this.state)}&nbsp; &nbsp; &nbsp; <td key={index}>{t.toString() + " : "}</td>&nbsp; &nbsp; &nbsp; <td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<div key={index} style={{color:'#01579b', cursor: 'pointer', border: '1px ridge'}} key={`link${index}`}&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onClick={this.downloadFile.bind(null,this.state.files[index])}>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.state.files[index].original_name}&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; </td>&nbsp; &nbsp;&nbsp; &nbsp; </tr>&nbsp; ))}在上面的代码块中,我们正在执行 this.state.files[index] 即在地图中我们位于索引 0 -> A,this.state.files[0] -> B在地图中,我们位于索引 1 -> A.1、this.state.files[1] -> B.1 等等。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript