#### 1. 數(shù)據(jù)表格接口數(shù)據(jù) --- ```json { "code": 0, "msg": "用戶(hù)信息", "count": 5, "data":[ { "id": 1, "name": "張三", "sex": "女", "prov": "河南", "city": "鄭州市", "dist": "金水區(qū)" }, { "id": 2, "name": "李四", "sex": "男", "prov": "河南", "city": "鄭州市", "dist": "金水區(qū)" }, { "id": 3, "name": "王五", "sex": "女", "prov": "河南", "city": "鄭州市", "dist": "二七區(qū)" }, { "id": 4, "name": "趙六", "sex": "女", "prov": "河南", "city": "開(kāi)封市", "dist": "龍亭區(qū)" }, { "id": 5, "name": "小七", "sex": "男", "prov": "河南", "city": "開(kāi)封市", "dist": "鼓樓區(qū)" } ] } ``` #### 2. 方法渲染數(shù)據(jù)表格 --- ```javascript table.render({ elem: '#demo' ,url: '/dbtable' //數(shù)據(jù)接口 ,cols: [ [ //標(biāo)題欄 {align: 'center', field: 'name', title: '姓名', rowspan: 2} //rowspan 合并行 ,{align: 'center', field: 'sex', title: '性別', rowspan: 2} ,{align: 'center', title: '地址', colspan: 3} //colspan 合并列 ], [ {align: 'center', field: 'prov', title: '省'} ,{align: 'center', field: 'city', title: '市'} ,{align: 'center', field: 'dist', title: '區(qū)'} ] ] }); ``` #### 3. 效果展示 --- ![](https://img.itqaq.com/art/content/f04eedbb81b549750a5084cd9fe4040b.png)