🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
> 自定义行模板 ``` // html <div class="form-group"> <label class="control-label col-xs-12 col-sm-2">{:__('Match_id')}:</label> <div class="col-xs-12 col-sm-8"> <input id="c-match_id" data-rule="" data-source="match/football_match/index" data-field="zh_name" class="form-control selectpage" name="row[match_id]" type="text" value=""> <p class="help-block-text text-info"> 赛程所属赛事,比如:意甲,德甲。。。 </p> </div> </div> // controller - `match/football_match` /** * Selectpage可显示的字段 */ protected $selectpageFields = 'id,en_name,zh_name'; //js $("#c-match_id").data("format-item", function(row){ return row.en_name + " - " + row.zh_name; }); ``` >选择事件 ``` // html <div class="form-group"> <label class="control-label col-xs-12 col-sm-2">{:__('Home_team')}:</label> <div class="col-xs-12 col-sm-8"> <input id="c-home_team_zh" data-rule="required" data-params='{"custom[status]":"1"}' data-primary-key="team_zh" data-source="match/football_team/index" data-field="team_zh" class="form-control selectpage" name="row[home_team_zh]" type="text" value=""> <p class="help-block-text text-success"> 请选择一个主队 </p> </div> //js $("#c-home_team_zh").data("eSelect", function(row){ //后续操作 $("#c-home_team").val(row.team_pt); $("#c-home_team_logo").val(row.logo); }); </div> ```