- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个包含过多页面的 R Shiny 网站(它应该基于教科书。)请注意,我在网络开发方面经验不足。我主修统计和数学,因此使用了 R。
我决定使用 R Shiny Router因为它似乎最适合我的多页用途。
但是,我真的很感激第二个导航栏。我看到了this tutorial使用具有辅助导航功能的 navbarPage() 和 navbarMenu()。这太棒了,这样我就可以轻松地将每一页分成几个部分!
目前我的路由器如下所示:
library(shiny)
library(shiny.router)
router = make_router(
route("/", div("home_page")),
route("section_3.2.1", div("page_3.2.1")),
route("section_3.2.2", div("page_3.2.2")),
route("section_3.2.3", div("page_3.2.3")),
route("section_3.2.4", div("page_3.2.4")),
route("section_3.3.1", div("page_3.3.1")),
route("section_3.3.2", div("page_3.3.2")),
route("contact", div("contact_page"))
)
ui = fluidPage(
theme = "main.css",
tags$ul(
tags$li(a(href = route_link("/"), "Home Page")),
tags$li(a(href = route_link("section_3.2.1"), "Section 3.2.1")),
tags$li(a(href = route_link("section_3.2.2"), "Section 3.2.2")),
tags$li(a(href = route_link("section_3.2.3"), "Section 3.2.3")),
tags$li(a(href = route_link("section_3.2.4"), "Section 3.2.4")),
tags$li(a(href = route_link("section_3.3.1"), "Section 3.3.1")),
tags$li(a(href = route_link("section_3.3.2"), "Section 3.3.2")),
tags$li(a(href = route_link("contact"), "Contact Page"))
),
router$ui
)
server <- function(input, output, session) {
router$server(input, output, session)
}
shinyApp(ui, server)
我天真地尝试了以下方法,希望它能起作用(注意我现在只用一个部分 3.2 测试了它)
ui = navbarPage("Website Title",
theme = "main.css",
tags$ul(
tags$li(a(href = route_link("/"), "Home Page")),
tags$li(a(href = route_link("contact"), "Contact Page"))
),
navbarMenu("Section 3.2",
tags$ul(
tags$li(a(href = route_link("section_3.2.1"), "Section 3.2.1")),
tags$li(a(href = route_link("section_3.2.2"), "Section 3.2.2")),
tags$li(a(href = route_link("section_3.2.3"), "Section 3.2.3")),
tags$li(a(href = route_link("section_3.2.4"), "Section 3.2.4")),
)),
router$ui
)
我得到这个错误:
Error: Navigation containers expect a collection of `bslib::nav()`/`shiny::tabPanel()`s and/or `bslib::nav_menu()`/`shiny::navbarMenu()`s. Consider using `header` or `footer` if you wish to place content above (or below) every panel's contents.
In addition: Warning messages:
1: Navigation containers expect a collection of `bslib::nav()`/`shiny::tabPanel()`s and/or `bslib::nav_menu()`/`shiny::navbarMenu()`s. Consider using `header` or `footer` if you wish to place content above (or below) every panel's contents.
2: Navigation containers expect a collection of `bslib::nav()`/`shiny::tabPanel()`s and/or `bslib::nav_menu()`/`shiny::navbarMenu()`s. Consider using `header` or `footer` if you wish to place content above (or below) every panel's contents.
对我来说,如果我需要使用 navbarMenu() 和/或 navbarPage(),我似乎必须使用 tabPanel(),由于我的代码太长,我不想使用它。
请告诉我是否有一种方法可以使辅助导航栏与 R Shiny Router 兼容?感谢任何回答的人!
编辑:为了更清楚我正在寻找的输出,我正在寻找以下内容:
目前我只有每一页,即主页、第 3.2.1 节、第 3.2.2 节、...、第 3.3.2 节、联系人,都在页面顶部。这是困惑且不可持续的,因为我需要添加第 4 节和第 5 节。
最佳答案
似乎 library(shiny.router)
使用的路由方法不适合将其与 navbarPage
上的选择同步,因为我们不能使用 router$ui
多次作为 tabPanel
的子项。
但是,我们可以使用 basic shiny 进行路由,如前所述here :
library(shiny)
ui <- navbarPage(title = "My Application",
tabPanel("Home", "Home content"),
navbarMenu("Section 3.2",
# To avoid the need to parse encoded URLs via utils::URLdecode use e.g.:
# tabPanel(title = "Section 3.2.1", "3.2.1 content", value = "section_3.2.1"),
tabPanel("Section 3.2.1", "3.2.1 content"),
tabPanel("Section 3.2.2", "3.2.2 content"),
tabPanel("Section 3.2.3", "3.2.3 content"),
tabPanel("Section 3.2.4", "3.2.4 content")
),
navbarMenu("Section 3.3",
tabPanel("Section 3.3.1", "3.3.1 content"),
tabPanel("Section 3.3.2", "3.3.2 content")
),
tabPanel("Contact", "Contact content"),
id = "navbarID",
theme = "main.css"
)
server <- function(input, output, session) {
observeEvent(session$clientData$url_hash, {
currentHash <- utils::URLdecode(sub("#", "", session$clientData$url_hash))
if(is.null(input$navbarID) || !is.null(currentHash) && currentHash != input$navbarID){
freezeReactiveValue(input, "navbarID")
updateNavbarPage(session, "navbarID", selected = currentHash)
}
}, priority = 1)
observeEvent(input$navbarID, {
currentHash <- sub("#", "", session$clientData$url_hash)
pushQueryString <- paste0("#", input$navbarID)
if(is.null(currentHash) || currentHash != input$navbarID){
freezeReactiveValue(input, "navbarID")
updateQueryString(pushQueryString, mode = "push", session)
}
}, priority = 0)
}
shinyApp(ui, server)
关于r - 使用辅助导航的 shiny.router 和 navbarPage 的 URI 路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74852297/
我正在尝试 specFlow 辅助,但不确定如何从表中创建类属性。 想象一下我有这门课: public class Tracking { public string Category { ge
我如何使用带 IOS 应用程序的辅助 GPS 来计算给定区域(例如建筑物)内部(或外部)某人的位置? 是否有可能在几英尺内就足够准确? 这样做正确吗? 是否可以在计算中使用多个 wifi 连接? 最佳
我在 wiki 和其他一些文本中看到,他们说冒泡排序、插入排序、选择排序等的空间复杂度是 O(1) 辅助。它们是否指的是程序中使用的变量所需的常量存储单元。 最佳答案 是的,他们指的是大多数排序都是就
默认情况下,页面上有 3 个点击事件(蓝色 X、蓝色 +、灰色 X)。每个人都会打开一个模式框。 每个模式框都有一个按钮。其中两个模态框,一个用于蓝色 X,一个用于蓝色 +,内部都有功能按钮。当我单击
我正在寻找 Kotlin 的 gigasecond 练习的解决方案:http://exercism.io/exercises/kotlin/gigasecond/readme 。我可以理解它如何需要两
我基本上刚刚开始使用 PyGame 进行开发,但我在整个 Sprite 概念方面遇到了麻烦。我一直在到处寻找有关如何使用它的指南,但似乎找不到任何指南。我想知道这一切是如何运作的基本概念。这是我一直在
我有一些无法运行的 JavaScript 代码。我尝试过移动一些东西,并更改一些关键字,但到目前为止没有任何效果。我会让你们尝试一下。 这是 JavaScript 文件: var GAME =
我有这个注册网页是我在帮助下创建的,感谢这里的人。在尝试使其响应之前,我只是做了一些调整。如何在复选框及其文本和底部的 div 之间创建空间而没有间隙。有什么建议吗? https://jsfiddle
我正在尝试检查是否启用了 WiFi 辅助。当我连接到我的接入点以获取一些数据时,我遇到了问题,当我的连接不佳时,我的蜂窝数据被使用并且它干扰了我的接入点。有什么方法可以检查是否启用了此选项? 最佳答案
为了安全起见,我希望使用异地复制/辅助 Blob 存储容器作为 AzureML 数据存储的数据源。所以我执行以下操作: 新数据存储 输入名称 + Azure Blob 存储 + 手动输入 对于 URL
我的讲师现在有一个我以前从未见过的奇怪习惯,我想知道这是 Haskell 标准还是他的编程风格的怪癖。 基本上,他经常会做这样的事情: functionEx :: String -> Int func
我想从可移动SD卡中删除文件,我尝试了很多方法但没有效果。 尝试过: file.delete(); 和 File file = new File(selectedFilePath); boolean
我正在开发一款 Android 应用,用户必须能够在其中进行身份验证,然后调用 YouTube 数据 API。 我可以毫无问题地使用主帐户对用户进行身份验证,使用 Google 登录对我和用户来说一切
命令: sudo mv /temp/hello.txt /path/to/destination/ 然后我通过 key 存储添加了密码。 我确信写在 sudo.password 中的密码是正确的。
我需要编写一个 java 代码来获取给定集群的辅助名称节点的 IP 地址。给定集群的 Namenode 的 IP 地址。 我能够获取数据节点和名称节点的报告,但无法找到获取辅助名称节点的 IP 地址的
Cay Horstmann 的书《不耐烦的 Scala》中的一个非常简单的练习一直让我感到困惑。是关于primary , auxiliary和 default primary构造函数: ex 5.10
我正在尝试确定 Google Cloud DNS 是否支持通过 NOTIFY 请求进行辅助 DNS (AXFR/IXFR) 传输?我在网上找不到任何东西,Google 也没有明确声明不支持它。 最佳答
我有一个简单的 Kotlin 类: data class ValveSpan(val begin:Duration, val end:Duration, val key:String):Compara
我有一个与最初在 UISplitView 中加载辅助 View 相关的快速问题。目前,我已经在 masterVC.swift 中获得了代码,可以用数组中的第一个对象(如果有)填充detailsVC。这
我正在使用这个命令来获取另一个命令的进程 ID: ps aux | grep 7000.conf | awk '{print $2}' 这将返回两个 PID: 7731 22125 我只想要第一个。第
我是一名优秀的程序员,十分优秀!