以编程方式关闭模态(反应实现)

时间:2020-03-06 10:49:30

标签: reactjs modal-dialog materialize

我不知道如何以编程方式关闭模式(例如,用户登录后的登录模式)。

它看起来像这样:

public class SelectedProductRequest : IEquatable<SelectedProductRequest>
{
    public int id {get;set;}
    public string Name {get;set;}
    public int Price {get;set;}
    public bool IsExclusive {get;set;}

    public bool Equals(SelectedProductRequest other) => other is null
        && this.id == other.id
        && this.Name == other.Name
        && this.Price == other.Price
        && this.IsExclusive == other.IsExclusive;

    public override bool Equals(object obj) => Equals(obj as SelectedProductRequest);
    public override int GetHashCode() => (id, Name, Price, IsExclusive).GetHashCode();
}

1 个答案:

答案 0 :(得分:1)

使用打开道具以编程方式打开或关闭模态

<Modal
  open={isModalOpen}
  ...
/>

参考:https://react-materialize.github.io/react-materialize/?path=/story/javascript-modal--default