layui table 表头和内容数据不能对齐


个人博客 地址:http://www.wenhaofan.com/article/20181224153019
今天使用layui table方法渲染时出现了个莫名其妙的错误

正常情况table应该是这样展示的

但是却展示成了这样

格子没对齐,找了半天原因发现是在table.render中的cols参数多了一个"," 不细心一点真看不出来

正常结构应是

	lemon.renderTable({
		url:""
		,elem: '#eduCourseDirectionTable'
		,cols: [[ //表头
		 {field:'pkId',width:60, sort: true,title:"ID", width:90}
		 ,{field:'name',title:"专业名称"}	
 		   ,{templet:'#tpl-direction-operation', title:"操作"}
		]]
	})

错误结构是:

lemon.renderTable({
		url:""
		,elem: '#eduCourseDirectionTable'
		,cols: [[ //表头
		 ,{field:'pkId',width:60, sort: true,title:"ID", width:90}
		 ,{field:'name',title:"专业名称"}	
 		   ,{templet:'#tpl-direction-operation', title:"操作"}
		]]
	})

注意错误示范中的那个红点,这就是罪魁祸首

猜你喜欢

转载自www.cnblogs.com/fanwenhao/p/10168850.html