treeTable怎么就是显示不出来 大神江湖救急啊

提问 未结 1 73
你是太阳会暖心
悬赏:20飞吻
版本:扩展组件 2.0 浏览器:谷歌
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<title>菜单管理</title>
<link rel="stylesheet" type="text/css" href="/webjars/layui/dist/css/layui.css">
<script src="/webjars/jquery/3.3.1/jquery.min.js"></script>
<script src="/webjars/layui/dist/layui.js"></script>

</head>
<body<%-- class="layui-layout-body" style="padding: 10px"--%>>

<div>
<table <%--class="layui-hide"--%> id = "menu" lay-filter="menu"></table>
</div>


<script>
var treeTable=null;

layui.config({
base : '../../js/tree/js/'
}).extend({
treeTable : 'treeTable'
}).use([ 'table', 'treeTable','layer' ], function() {
var $ = layui.jquery;
var table = layui.table;
treeTable = layui.treeTable;

// 渲染表格
var renderTable=function(){
layer.load(2);
treeTable.render({
elem: '#menu',// 必须

data: [{"id":1,"pid":0,"title":"1-1"},{"id":2,"pid":0,"title":"1-2"},{"id":3,"pid":0,"title":"1-3"},{"id":4,"pid":1,"title":"1-1-1"},{"id":5,"pid":1,"title":"1-1-2"},{"id":6,"pid":2,"title":"1-2-1"},{"id":7,"pid":2,"title":"1-2-3"},{"id":8,"pid":3,"title":"1-3-1"},{"id":9,"pid":3,"title":"1-3-2"},{"id":10,"pid":4,"title":"1-1-1-1"},{"id":11,"pid":4,"title":"1-1-1-2"}],
icon_key: 'title',// 必须
top_value: 0,
primary_key: 'id',
parent_key: 'pid',
/*hide_class: 'layui-hide',*/
icon: {
open: 'layui-icon layui-icon-triangle-d',
close: 'layui-icon layui-icon-triangle-r',
left: 16,
},
cols: [{
key: 'id',
title: '名称',
width: '100px'
},{
key: 'pid',
title: '父',
width: '100px'
},{
key: 'title',
title: 'title',
width: '100px'
}/*,{},...*/],
checked: {
key: 'id',
data: [0,1,4,10,11,5,2,6,7,3,8,9]
},
is_click_icon: false,
is_checkbox: false,
is_cache: true,
end: function(e){},
})}
renderTable();
});

</script>



</body>
</html>






回帖