【问题标题】:Yii2 detailView highlight value on conditionYii2 detailView 条件高亮值
【发布时间】:2016-02-20 21:27:58
【问题描述】:

如何根据条件突出显示 yii2 detailView 中的值? 我试过这种方式(有和没有'type' => 'raw''html'),但没有运气:

[
    'attribute' => 'attribute',
    'type' => 'raw',
    'value' => $model->attribute > 1 ? '<b>' . $model->attribute . '</b>' : $model->attribute,
],

谢谢!

【问题讨论】:

    标签: formatting yii2 conditional-statements detailview


    【解决方案1】:

    您需要使用format 属性,而不是type

    'format' => 'html'
    

    【讨论】:

      猜你喜欢
      • 2017-07-10
      • 1970-01-01
      • 2020-01-21
      • 2016-03-24
      • 2016-05-05
      • 1970-01-01
      • 2016-02-05
      • 1970-01-01
      • 2017-03-26
      相关资源
      最近更新 更多