fastadmin常用前端组件
1.下拉菜单,三级联动
<div class="form-group"> <label class="control-label col-xs-12 col-sm-2">省、市、区</label> <div class="col-xs-12 col-sm-8"> <div id="locations"> <div class="location"> <div class="form-control-static"> <div class="form-inline" data-toggle="cxselect" data-selects="province,city,district">: <select class="province form-control" data-value="{$row.province_id|htmlentities}" data-rule="required" data-target="#location-error" name="row[province_id]" data-query-name="pid" data-url="xilujob/job/area" > </select> <select class="city form-control" data-value="{$row.city_id|htmlentities}" data-rule="required" data-target="#location-error" name="row[city_id]" data-query-name="pid" data-url="xilujob/job/area"> </select> <select class="district form-control" data-value="{$row.district_id|htmlentities}" data-rule="required" data-target="#location-error" name="row[district_id]" data-query-name="pid" data-url="xilujob/job/area"> </select> </div> </div> </div> </div> </div> </div>
属性值
data-value 默认选中值,在编辑页面中常用
data-url = 服务端获取选项的地址
data-query-name url的参数,例如上述代码,加上数值联动后变为 /xilujob/job/area?pid=466,其中pid 即为 data-query-name定义
服务端的json格式如下
{ "code": 1, "msg": "", "data": [ // 最主要为data值,其他无所谓 { "value": 2, "name": "北京市" } ], "url": "xilujob.job/area", "wait": 3 }