box(853, title = "No of Employees", width = 2, height = "155px", status = "primary", solidHeader = TRUE, id = "empid")
产生
<div class="col-sm-2">
<div class="box box-solid box-primary" style="height: 155px">
<div class="box-header">
<h3 class="box-title">No of Employees</h3>
</div>
<div class="box-body" id="empid">853</div>
</div>
</div>
您可能会看到生成class = "box-title"
。
我想创建一个新函数,我想要修复宽度,高度,状态和solidheader
所以我创建了一个,
vas_metric_box <- function(..., title, w = 2, h = "155px", id = NULL){
box(..., title, solidHeader = TRUE, status = "primary", width = w, height = h, id = id)
}
产生
<div class="col-sm-2">
<div class="box box-solid box-primary" style="height: 155px">
<div class="box-body" id="empid">
853
No of Employees
</div>
</div>
</div>
问题
1)如何在代码中生成方框标题。 2)我在我的函数中使用相同的代码,为什么两种方法之间存在差异?
答案 0 :(得分:1)
title
无法正确解释box
在vas_metric_box
内呼叫box
时的方式。写得像这样:
vas_metric_box <- function(..., title, w = 2, h = "155px", id = NULL){
box(..., title = title, solidHeader = TRUE, status = "primary", width = w, height = h, id = id)
}