我正在使用反应模式
该文档提到,默认情况下,当您单击叠加层时,模态应该关闭。即使我将shouldCloseOnOverlayClickprop设置为 true,这仍然不起作用。
我不知道有什么可能会阻止该事件发生。
如果这与任何内容相关/指示(我还没有弄清楚为什么会显示),我在 Chrome 开发人员工具中注意到我的模式的覆盖和内容节点都有一个未定义的类。我使用的所有 CSS 类都已定义并正常工作。
这是相关的 JSX 和 CSS,如果需要更多上下文,请告诉我。
JSX:
return (
<div className="Modal">
<Modal
className={{
base: 'Modal-content' + ' Modal-InputError-videoURL'
}}
overlayClassName={{
base: 'Modal-overlay'
}}
isOpen={true}
contentLabel="Modal"
>
{props.message}
<br />
<br />
<br />
<button
className="Modal-button"
onClick={events.handleCloseModal}
>
Close
</button>
</Modal>
</div>
)
Run Code Online (Sandbox Code Playgroud)
CSS类:
.Modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.35);
z-index: 9998;
}
.Modal-content {
display: relative;
position: absolute;
top: 50%;
left: 50%; …Run Code Online (Sandbox Code Playgroud) 我有一个列/外键,resolver_id我希望能够拥有空值(即:Rails 迁移使列成为空 => true)。假设我的迁移中有以下行:
def
change_column_null :bugs, :resolver_id, true
end
Run Code Online (Sandbox Code Playgroud)
但是,在运行成功迁移后(即生成迁移并运行rails db:migrate),除了版本号外,架构保持不变:
t.integer "resolver_id"
而我期待:
t.integer "resolver_id" , null: true
有什么我想念的吗?
我也试过change_column像这样使用:
change_column :bugs, :resolver_id, :integer, null: true
但是,这仍然没有反映在架构中。在rails g migration和db:migrate模式中的工作蛮好的,版本号相匹配的最新迁移。
作为参考,这是我的架构:
ActiveRecord::Schema.define(version: 20170502203934) do
create_table "bugs", force: :cascade do |t|
t.string "name"
t.text "error_msg"
t.text "description"
t.text "causes"
t.boolean "resolved"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.integer "resolver_id"
t.index ["resolver_id"], name: "index_bugs_on_resolver_id"
t.index …Run Code Online (Sandbox Code Playgroud)