удалить текстовое сообщение, нажав на кнопку - PullRequest
0 голосов
/ 29 января 2020

ниже мой представитель. После нажатия кнопки загрузки появится текст. После нажатия кнопки очистки текст должен go выключиться. Хотел проверить способ сделать это. Может ли кто-нибудь помочь мне здесь

---
title: "Untitled"
runtime : shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
code <- "This is code"
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
actionButton("upload","Upload",width = 150)
actionButton("clear_upload","Clear",width = 150)
verbatimTextOutput("code")
   get_code <- eventReactive(input$upload,{
     code
   })

   output$code <- renderPrint(
     get_code()
   )
```

1 Ответ

0 голосов
/ 30 января 2020

Если я правильно понял вашу проблему, вы можете использовать оператор observeEvent:

---
title: "Untitled"
runtime : shiny
output: 
    flexdashboard::flex_dashboard:
    orientation: columns
vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
code <- "This is code"
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
actionButton("upload","Upload",width = 150)
actionButton("clear_upload","Clear",width = 150)
verbatimTextOutput("code")

 get_code <- eventReactive(input$upload,{
     code
   })

observeEvent(input$upload, {output$code <- renderPrint(get_code())})
observeEvent(input$clear_upload, {output$code <- renderPrint("")})
```
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...