report-design-javascript/src/script/TemplateClasses.ts

56 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-10-16 16:32:22 +08:00
// 表格类
class Table {
rowLength: number;
columnLength: number;
selectedRow: string;
selectedCell: string;
instanceOfCells: any;
constructor(rowLength: number, columnLength: number, instanceOfCells: any) {
this.rowLength = rowLength;
this.columnLength = columnLength;
this.instanceOfCells = instanceOfCells;
this.selectedRow;
this.selectedCell;
}
render() {}
addRowElement() {}
}
// 行类
class Row {
createRowElement() {
const rowElement = document.createElement("tr");
return rowElement;
}
}
// 单元类
class Cell {
cellId: string;
border: string;
color: string;
width: number;
colspan: string;
fontSize: string;
constructor(id) {
this.cellId = id;
this.border = "";
this.color = "";
this.width = 80;
this.colspan = "1";
this.fontSize = "12";
}
CreateCellElement() {
let tdElement = document.createElement("td");
tdElement.setAttribute("colspan", this.colspan);
tdElement.style.backgroundColor = this.color;
tdElement.style.width = this.width + "px";
tdElement.style.border = this.border + "px solid";
tdElement.style.fontSize = this.fontSize + "px";
tdElement.innerHTML = this.cellId;
return tdElement;
}
}
export { Table, Cell };