after read source code of rmarkdown, I realise it is caused by a div box. I am doing some modification and workaround, will update if it works in few days.
tags$div(
tags$head(
tags$script(src = "rmd_resources/rmd_loader.js"),
tags$link(href = "rmd_resources/rmd_loader.css", rel = "stylesheet")
),
# Shiny shows the outer conditionalPanel as long as the document hasn't
# loaded; the inner rmd_loader is shown by rmd_loader.js as soon as
# we've been waiting a certain number of ms
shiny::conditionalPanel(
"!output.__reactivedoc__",
tags$div(
id = "rmd_loader_wrapper",
tags$div(id = "rmd_loader", style = "display: none",
tags$p("Please wait..."),
tags$img(src = "rmd_resources/rmd_loader.gif")))),
shiny::uiOutput("__reactivedoc__")
)