shinydashboard 一些 Font Awesome 图标不起作用

2024-03-14

使用时shinydashboard我发现有些图标似乎有效,而有些则无效。在下面的示例中,电池充满图标不起作用,而时钟图标则工作正常。我无法弄清楚为什么会发生这种情况。

library(shiny)
library(shinydashboard)

header <- dashboardHeader(title="Some Icons Not Working?")

# No sidebar --------------------------------------------------------------

sm <- sidebarMenu(

  sm <- sidebarMenu(
    menuItem(
      text="asdf",
      tabName="asdfasdf",
      icon=icon("battery-full")),
    menuItem(
      text="qwer",
      tabName="qwerqwer",
      icon=icon("clock-o"))
  )
)

sidebar <- dashboardSidebar(sm)

# Compose dashboard body --------------------------------------------------

body <- dashboardBody(

  tabItems(

  )
)

# Setup Shiny app UI components -------------------------------------------

ui <- dashboardPage(header, sidebar, body, skin="black")

# Setup Shiny app back-end components -------------------------------------

server <- function(input, output) {


}

# Render Shiny app --------------------------------------------------------

shinyApp(ui, server)

好吧,我认为4.4版本的新内容没有更新。你或许可以要求shiny团队来更新它们,他们会很容易做到。或者,您可以通过下载它们并替换以前的内容来自己完成...

1. Go to the Font Awesome download page https://fortawesome.github.io/Font-Awesome/ and get it enter image description here

2.找到您的字体真棒你安装的文件夹shiny包裹。这应该是像这里这样的地方~\Documents\R\win-library\3.1\shiny\www\shared\font-awesome

3. Replace the content of this folder with new contents (you can delete the previous content if you want). Below is what I put in there enter image description here

4. Now your app should work fine with new fonts enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

shinydashboard 一些 Font Awesome 图标不起作用 的相关文章

随机推荐