小编Rom*_*eev的帖子

在 material-ui 中为网格项指定“对齐”的最佳方法是什么?

我从material-UI图书馆有一个简单的网格。它看起来像这样:

<Grid container>
    <Grid item sm={6}>
        <SearchPanel/>
    </Grid>
    <Grid item sm={6}>
        <ItemStatusFilter/>
    </Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)

我只是不明白如何在中心对齐第一个网格项,例如在右侧对齐第二个网格项?

UPD:我可以justify-content: flex-end!important在我的CSS文件中做到这一点,但我不确定这是最好的方法。

reactjs material-ui

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

如何使用“onclick”事件更改 ListItem 元素的样式?

我的目标是当我单击 ListItem 时,它应该更改background-colortext: "line-through"。然后,如果我再次单击,这些更改应该被取消。
但这对我来说发生得很奇怪。我只是不明白为什么只有在我点击窗口的任何地方后才会ListItem改变background-color?以及为什么只有在我将指针移到元素之外后,ListItem 中的文本才会被划掉

const styles = () => ({
  listItem: {
    borderRadius: "1em"
  },

  listItemDone: {
    borderRadius: "1em",
    backgroundColor: "#F6F6E8",
    textDecoration: "line-through"
  },

  iconButton: {
    padding: 5
  },

  important: {
    color: "#00ACE9",
    fontWeight: "bold"
  }
});

class TodoListItem extends Component {
  state = {
    done: false
  };

  onClickItem = () => {
    this.setState({
      done: !this.state.done
    });
  };

  render() {
    const { label, important = false, classes } = this.props; …
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

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

如何将可嵌入的学说与 json 列一起使用?

在我的 Symfony 项目中,我有一个包含嵌套对象的学说实体。就像下面的例子一样:

/**
 * @ORM\Entity(repositoryClass="App\Repository\EntityRepository")
 */
class Enity
{
    /**
     * @ORM\Id()
     *
     * @var int
     */
    private $id;

    /**
     * @ORM\Column(type="json")
     *
     * @var NestedObject
     */
    private $nestedObject;

    public function getNestedObject(): NestedObject
    {
        return $this->nestedObject;
    }

    public function setNestedObject(NestedObject $object): void
    {
        $this->nestedObject = $object;
    }
}   
Run Code Online (Sandbox Code Playgroud)

和嵌套对象:

class NestedObject
{
    /**
     * @var FirstOption
     */
    private $firstOption;

    /**
     * @var SecondOption
     */
    private $secondOption;

    /**
     * @return FirstOption
     */
    public function getFirstOption(): FirstOption
    {
        return $this->firstOption;
    } …
Run Code Online (Sandbox Code Playgroud)

php postgresql doctrine symfony doctrine-orm

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