小编pet*_*ojs的帖子

如何将输入链接到React Router链接

我正在一个react.js项目上,该项目需要一个图像按钮或一个输入到React Router链接的输入,但我似乎找不到解决方法。

这是我的代码:

render: function() {
return (
  <div className="Item" style={{backgroundImage: 'url(' +    this.props.poster + ')'}} >
    <div className="overlay">
      <div className="title">{this.props.title}</div>
      <div className="rating">{this.props.score} / 10</div>
      <div className="plot">{this.props.overview}</div>
      <div className="play"><input className="button" type="image" src="www.url.to/the/image"></input></div>
      <Link to={`/${this.props.id}`} id="link"/>
      <ListToggle />
    </div>
  </div>
 );
}
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

1
推荐指数
1
解决办法
2571
查看次数

Why do all objects get populated with the same coordinates?

I'm creating a program for a robot to map out a labyrinth. I'm doing this in Python and the problem is when I'm trying to create a 3D array with my objects by looping through it, somehow every object gets populated with [9, 9, 2].

class Field:
    coordinates = {}

    def __init__(self, x_arg, y_arg, z_arg = None):
        self.coordinates['x'] = x_arg
        self.coordinates['y'] = y_arg
        if z_arg is not None:
            self.coordinates['z'] = z_arg
        else:
            self.coordinates['z'] = 0

    def update_location(self, x_arg, y_arg, z_arg …
Run Code Online (Sandbox Code Playgroud)

python

1
推荐指数
1
解决办法
31
查看次数

标签 统计

python ×1

react-router ×1

reactjs ×1