我希望在我点击按钮时计算renderValueBox
,而不是自动计算。
我试过使用actionButton
,但它不起作用。我也无法使用flexdashboard
中的submitButton
函数,但它也不起作用。
我想只使用Shiny::actionButton
函数(文档推荐)来做到这一点。我的代码:
---
title: "Sum"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
theme: yeti
---
side{.sidebar}
-------------------------------------------
```{r}
库(Tibble)
库(闪亮)
库(ShinyWidgets)
库(Flexdashboard)
库(比例)
**Análise**
```{r}
autonumericInput(
inputId = "a",
值= 0,
label = "Value 1",
align = "center",
currencySymbol = "R$",
currencySymbolPlacement = "p",
decimalPlaces = 2,
digitGroupSeparator = ".",
decimalCharacter = ",“
)
autonumericInput(
inputId = "b",
值= 0,
label = "Value 2",
align = "center",
currencySymbol = "R$",
currencySymbolPlacement = "p",
decimalPlaces = 2,
digitGroupSeparator = ".",
decimalCharacter = ",“
)
actionButton(“执行”,“计算”)
```{r}
f_1 <-函数(a,b) {
A+b
}
```{r}
reac <- eventReactive(输入$execute,{
X= tibble(
a = input$a,
b = input$b
)
},ignoreNULL = FALSE)
pred <-反应性({
temp <- reac()
f_1(
a = input$a,
b = input$b
)
})
abc{}
--------------------------------------
###
```{r}
renderValueBox({
valueBox(
value = scales::dollar(x = round(x = pred(), digits = 4), prefix = "$ ", suffix = " dollar(s)", big.mark = ",", decimal.mark = "."),
caption = "Sum",
color = "steelblue",
icon = "fa-plus"
)
})
转载请注明出处:http://www.songfuwangmfj.com/article/20230526/1379277.html