{% if type == 'all' %} <a href="#" type="button" class="btn btn-green">全部</a> {% else %} <a href="/myApp/company/?type=all" type="button" class="btn btn-default">全部</a> {% endif %}
时间: 2024-02-14 21:07:11 浏览: 9
这是一个模板语言中的条件语句,用于根据变量 `type` 的值来输出不同的 HTML 代码。如果变量 `type` 等于字符串 `'all'`,则输出一个绿色按钮,按钮上显示文字“全部”。否则,输出一个默认按钮,按钮上显示文字“全部”,并且链接指向 `/myApp/company/?type=all`。
相关问题
{% for i in typeList %} {% if type == i %} <a href="#" type="button" class="btn btn-green">{{ i }}</a> {% else %} <a href="/myApp/company/?type={{ i }}" type="button" class="btn btn-default">{{ i }}</a> {% endif %} {% endfor %}
这也是一个模板语言中的循环语句,用于遍历变量 `typeList` 中的元素,输出一系列 HTML 按钮。在循环体中,首先使用条件语句判断当前元素是否等于变量 `type`,如果是,则输出一个绿色按钮,按钮上显示元素的值。否则,输出一个默认按钮,按钮上显示元素的值,并且将链接指向 `/myApp/company/?type={{ i }}`,其中 `{{ i }}` 表示当前元素的值。最后,在循环结束后,会将所有按钮连成一行输出。
<div class="page-content"> <div class="row"> <div class="col-xs-12"> <div class="hr hr-18 dotted hr-double"></div> <h4 class="pink"> <i class="icon-hand-right icon-animated-hand-pointer blue"></i> <a href="#" role="button" class="green" data-toggle="modal"> 商品管理 </a> </h4> <div class="hr hr-18 dotted hr-double"></div> <div class="form-search"> <form role="form" class="form-inline clearfix" id="form" action=""> <div class="input-group col-sm-2"> <span class="input-group-addon">商品名</span> <input type="text" class="form-control" name="name" value="${name}"> </div> <div class="form-tool btn-group"> <button class="btn btn-sm btn-success" form="form"> <i class="icon-search"></i>搜索 </button> <a class="btn btn-sm btn-primary" href="/admin/goods/detail/0"> <i class="icon-plus"></i>添加 </a> </div> </form>
这段代码是一个页面的 HTML 代码,包括了商品管理页面的搜索框和添加按钮。其中使用了 Bootstrap 框架提供的样式和组件,如 input-group、btn-group 等。搜索框位于 input-group 中,包括了一个输入框和一个输入框前的提示文字。添加按钮使用了 btn-group 中的两个按钮,其中一个使用了 icon-search 图标,另一个使用了 icon-plus 图标。整个表单使用了 form-search 类,其中包括了一个 form 表单,使用了 form-inline 类,表示将表单的元素排成一行。同时,form 表单中的 input 和 button 元素都使用了 Bootstrap 框架提供的样式。