优化 table 示例细节

pull/1321/head
贤心 2023-08-15 11:25:56 +08:00
parent 0e4cca4e3e
commit d598c8de84
1 changed files with 5 additions and 5 deletions

View File

@ -3,7 +3,7 @@
<script type="text/html" id="TPL-select-primary"> <script type="text/html" id="TPL-select-primary">
{{# var cityList = d.cityList || ["北京","上海","广州","城市-1"]; }} {{# var cityList = d.cityList || ["北京","上海","广州","城市-1"]; }}
<select name="city" class="layui-border select-demo-primary" lay-ignore> <select name="city" class="layui-border select-demo-primary" lay-ignore>
<option value="">原生 select</option> <option value="">原生 select</option>
{{# layui.each(cityList, function(i, v){ }} {{# layui.each(cityList, function(i, v){ }}
<option value="{{= v }}" {{= v === d.city ? 'selected' : '' }}>{{= v }}</option> <option value="{{= v }}" {{= v === d.city ? 'selected' : '' }}>{{= v }}</option>
{{# }); }} {{# }); }}
@ -53,17 +53,17 @@ layui.use(function(){
page: true, page: true,
css: [ // 设置单元格样式 css: [ // 设置单元格样式
// 取消默认的溢出隐藏,并设置适当高度 // 取消默认的溢出隐藏,并设置适当高度
'.layui-table-cell{height: 50px; line-height: 40px; overflow: visible;}', '.layui-table-cell{height: 50px; line-height: 40px;}',
'.layui-table-cell .layui-colorpicker{width: 38px; height: 38px;}', '.layui-table-cell .layui-colorpicker{width: 38px; height: 38px;}',
'.layui-table-cell select{height: 36px; padding: 0 5px;}' '.layui-table-cell select{height: 36px; padding: 0 5px;}'
].join(''), ].join(''),
cols: [[ // 表头 cols: [[ // 表头
{field: 'id', title: 'ID', width:80, align: 'center', fixed: 'left'}, {field: 'id', title: 'ID', width:80, align: 'center', fixed: 'left'},
{field: 'city', title: '原生 select', width:150, templet: '#TPL-select-primary'}, {field: 'city', title: '原生 select', width:135, unresize: true, templet: '#TPL-select-primary'},
//{field: 'city', title: 'layui select', width:150, templet: '#TPL-select-city'}, //{field: 'city', title: 'layui select', width:150, templet: '#TPL-select-city'},
{field: 'sex', title: 'dropdown', width:115, align: 'center', templet: '#TPL-dropdpwn-demo'}, {field: 'sex', title: 'dropdown', width:115, unresize: true, align: 'center', templet: '#TPL-dropdpwn-demo'},
{field: 'date', title: 'laydate', width:150, templet: '#TPL-laydate-demo'}, {field: 'date', title: 'laydate', width:150, templet: '#TPL-laydate-demo'},
{field: 'color', title: 'colorpicker', width:100, align: 'center', templet: '#TPL-colorpicker-demo'}, {field: 'color', title: 'color', width:80, unresize: true, align: 'center', templet: '#TPL-colorpicker-demo'},
{field: 'sign', title: '文本', edit: 'textarea'} {field: 'sign', title: '文本', edit: 'textarea'}
]], ]],
done: function(res, curr, count){ done: function(res, curr, count){