代码拉取完成,页面将自动刷新
同步操作将从 清晨de阳光/ng-x-table 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
x-table
是一款可配置化的 Angular 数据表格组件。并不依赖于其他UI组件库。
![]() |
![]() |
![]() |
![]() |
---|---|---|---|
Edge | Chrome | Firefox | Safari 13.1+ |
npm i @ng-dms/x-table --save
在根模块 AppModule
导入 BrowserAnimationsModule
HttpClientModule
.
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { SharedModule } from './shared/shared.module';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
SharedModule,
],
bootstrap: [AppComponent]
})
export class AppModule { }
在业务级模块 或 sharedModule
导入 @ng-dms/x-table
import { XTableModule } from '@ng-dms/x-table';
@NgModule({
declarations: [],
imports: [
SharedModule
]
})
export class SharedModule { }
import { Component, OnInit } from '@angular/core';
import { XTableColumns } from '@ng-dms/x-table';
@Component({
selector: 'x-table-base',
template: `
<x-table [columns]="columns" [xData]="rows"></x-table>
`,
styles: []
})
export class XTableBaseComponent implements OnInit {
columns: XTableColumns = [
{ title: '学号', field: 'no' },
{ title: '姓名', field: 'name' },
{ title: '性别', field: 'sex' },
{ title: '年龄', field: 'age' },
{ title: '学院', field: 'college' },
{ title: '专业', field: 'major' },
{ title: '班级', field: 'class' },
];
rows = [
{ "id": 1, "no": 7107320614, "name": "黎勇", "sex": 0, "age": 28, "college": "外语外贸学院", "major": "国际邮轮乘务管理", "class": 1 },
{ "id": 2, "no": 7107320615, "name": "黎秀兰", "sex": 1, "age": 26, "college": "外语外贸学院", "major": "国际贸易实务", "class": 1 },
{ "id": 3, "no": 7107320616, "name": "董霞", "sex": 0, "age": 26, "college": "外语外贸学院", "major": "国际贸易实务", "class": 2 },
{ "id": 4, "no": 7107320617, "name": "梁磊", "sex": 0, "age": 21, "college": "土木工程学院", "major": "建筑工程技术", "class": 1 },
{ "id": 5, "no": 7107320618, "name": "潘娟", "sex": 0, "age": 24, "college": "外语外贸学院", "major": "国际邮轮乘务管理", "class": 1 }
];
constructor() { }
ngOnInit() { }
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。