问题描述
我想把 actionButton 和 downloadButton 的宽度都设置成 300px,可是发现 downloadButton 没有 width参数,不知道如何实现。能否用 actionButton 代替 downloadButton?
我的代码
library(shiny)
library(shinydashboard)
ui = dashboardPage(
dashboardHeader(title = "文档自动化"),
dashboardSidebar(
sidebarMenu(
menuItem("开始使用", tabName = "start")
)
),
dashboardBody(
tabItems(
tabItem(
tabName = "start",
fluidPage(
sidebarLayout(
sidebarPanel(
textInput("dpmt", "定义报告部门:", value = "人力资源部")
),
mainPanel(
fluidPage(
actionButton(
"button2", "预览文档", width = "300px",
class = "btn-primary btn-md"
)
),
br(),
fluidPage(
downloadButton(
"button3", "下载文档", width = "300px",
icon = icon("download"),
class = "btn-primary btn-md"
)
)
)
)
)
)
)
)
)
server = function(input, output, session) {}
shinyApp(ui = ui, server = server)
系统信息
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS, RStudio 2022.7.1.554
Locale:
LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C LC_TIME=zh_CN.UTF-8
LC_COLLATE=zh_CN.UTF-8 LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8
LC_PAPER=zh_CN.UTF-8 LC_NAME=C LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
Package version:
base64enc_0.1.3 bslib_0.4.0 cachem_1.0.6 commonmark_1.8.0
crayon_1.5.1 digest_0.6.29 ellipsis_0.3.2 fastmap_1.1.0
fontawesome_0.3.0 fs_1.5.2 glue_1.6.2 graphics_4.2.1
grDevices_4.2.1 htmltools_0.5.3 httpuv_1.6.5 jquerylib_0.1.4
jsonlite_1.8.0 later_1.3.0 lifecycle_1.0.1 magrittr_2.0.3
memoise_2.0.1 methods_4.2.1 mime_0.12 promises_1.2.0.1
R6_2.5.1 rappdirs_0.3.3 Rcpp_1.0.9 rlang_1.0.4
sass_0.4.2 shiny_1.7.2 shinydashboard_0.7.2 sourcetools_0.1.7
stats_4.2.1 tools_4.2.1 utils_4.2.1 withr_2.5.0
xtable_1.8.4