");
}
var table = "";
table += "
";
if (this.headers != null) {
table += "";
for (let header in this.headers) {
table += "" + this.headers[header] + " | ";
}
table += "
";
}
if (this.data != null) {
for (let tr in this.data) {
table += "";
for (let td in this.data[tr]) {
table += "" + this.data[tr][td] + " | ";
}
table += "
";
}
}
table += "
";
document.getElementById(id).innerHTML = table;
console.log("success!");
} catch (e) {
console.error(e);
}
}
}
//初始化调用
;
(function() {
let headers = {
name: '姓名',
age: '年龄',
high: '身高',
weight: '体重',
school: '学校',
birth: '生日'
};
let data = [{
name: 'john',
age: 18,
high: '190cm',
weight: '180',
school: '交大',
birth: '2001-01-01'
}, {
name: 'jack',
age: 18,
high: '180cm',
weight: '160',
school: '交大',
birth: '2001-01-01'
}];
let style;
hxj_table.init(headers, data, style).show();
})()