laravel 渲染与layui templet 渲染冲突解决方法


 laravel 渲染与layui. laytpl渲染冲突解决方法

1、switch

{field: 'status', width: 100, title: '订单状态',templet: '#imageTpl'},

<script type="text/html" id="imageTpl">
<input type="checkbox" name="status" value="@{{ d.id}}" title="锁定" lay-skin="switch" lay-text="锁定|正常" lay-filter="lock" @{{ d.status == 0 ? 'checked' : '' }}>
</script>

 

2、layui表格渲染templet解析单元格

{field: 'tpye', title: '所属类别', align:"center",templet:'#typeBar'}

(2-1)写法

{field: 'ordertype', title: '订单类型', align:'center',templet:function(d){
return d.ordertype == "elvan" ? "代购" : "私有";
}},

(2-2)写法

<script type="text/html" id="typeBar">
@{{# if(d.tpye == 1){ }}
系统优化
@{{# }else if(d.tpye==2){ }}
使用中问题
@{{# }else { }}
使用中问题
@{{# } }}
</script>

(2-3)写法

<script type="text/html" id="stateBar">
@{{# if(d.state == '0'){ }}
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="已提交" lay-filter="lockDemo" {{ d.state==0 ? 'checked' : '' }}> 
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="处理中" lay-filter="lockDemo" {{ d.state==1 ? 'checked' : '' }}> 
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="已处理" lay-filter="lockDemo" {{ d.state==2 ? 'checked' : '' }}>
@{{# } else if(d.state == '1') { }}
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="已提交" lay-filter="lockDemo" {{ d.state==0 ? 'checked' : '' }}> 
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="处理中" lay-filter="lockDemo" {{ d.state==1 ? 'checked' : '' }}> 
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="已处理" lay-filter="lockDemo" {{ d.state==2 ? 'checked' : '' }}>
@{{# } else { }}
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="已提交" lay-filter="lockDemo" {{ d.state==0 ? 'checked' : '' }}> 
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="处理中" lay-filter="lockDemo" {{ d.state==1 ? 'checked' : '' }}> 
<input type="radio" name="state{{d.id}}" value="{{d.id}}" title="已处理" lay-filter="lockDemo" {{ d.state==2 ? 'checked' : '' }}>
@{{# }
}}
</script>

  

 

posted @ 2020-08-31 14:44  pinkpolk  阅读(788)  评论(0编辑  收藏  举报