bsModal 与 fluidPage 一起工作但不是没有它
bsModal works with fluidPage but not without it
我发现 bsModal 与 fluidPage 一起按预期工作,但在没有它的情况下并非如此。只需单击 "View Table" 按钮即可查看差异。
带有fluidPage的版本:
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("tabBut", "View Table")
),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
"distTable")
)
)
),
server =
function(input, output, session) {}
)
没有fluidPage的版本,唯一的变化就是fluidPage被tagList:
代替了
library(shiny)
library(shinyBS)
shinyApp(
ui =
tagList(
sidebarLayout(
sidebarPanel(
actionButton("tabBut", "View Table")
),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
"distTable")
)
)
),
server =
function(input, output, session) {}
)
谁能帮我解释一下 bsModal 和 fluidPage 之间发生了什么?
因为 fluidPage
远远超过简单的 tagList
。
tagList
只是接受它的参数并将它们连接起来(期望每个参数都是某种 HTML 标签)。 fluidPage
从字面上生成具有 bootstrap 依赖关系的整个 HTML 文档。
你的第一个例子是比喻性的 "build a house with basement, floor plan and attic",其中 sidebarLayout
解释了楼层的布局,fluidPage
是房子。删除 fluidPage
并且您正在尝试建造具有地下室、平面图和阁楼但没有地基、墙壁或屋顶的房屋。
我发现 bsModal 与 fluidPage 一起按预期工作,但在没有它的情况下并非如此。只需单击 "View Table" 按钮即可查看差异。
带有fluidPage的版本:
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("tabBut", "View Table")
),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
"distTable")
)
)
),
server =
function(input, output, session) {}
)
没有fluidPage的版本,唯一的变化就是fluidPage被tagList:
代替了library(shiny)
library(shinyBS)
shinyApp(
ui =
tagList(
sidebarLayout(
sidebarPanel(
actionButton("tabBut", "View Table")
),
mainPanel(
bsModal("modalExample", "Data Table", "tabBut", size = "large",
"distTable")
)
)
),
server =
function(input, output, session) {}
)
谁能帮我解释一下 bsModal 和 fluidPage 之间发生了什么?
因为 fluidPage
远远超过简单的 tagList
。
tagList
只是接受它的参数并将它们连接起来(期望每个参数都是某种 HTML 标签)。 fluidPage
从字面上生成具有 bootstrap 依赖关系的整个 HTML 文档。
你的第一个例子是比喻性的 "build a house with basement, floor plan and attic",其中 sidebarLayout
解释了楼层的布局,fluidPage
是房子。删除 fluidPage
并且您正在尝试建造具有地下室、平面图和阁楼但没有地基、墙壁或屋顶的房屋。