1 Star 0 Fork 23

vincent / ng-x-table

forked from 清晨de阳光 / ng-x-table 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ng-x-table

概述

x-table 是一款可配置化的 Angular 数据表格组件。并不依赖于其他UI组件库。

文档与示例

https://xujz520.gitee.io/ng-easy-mock/x-table/

浏览器环境

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 { }

组件代码

在 StackBlitz 上打开

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() { }

}
MIT License Copyright (c) 2021 清晨de阳光 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

x-table 是一款可配置化的 Angular 数据表格组件。并不依赖于其他UI组件库。 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/myn_wsc/ng-x-table.git
git@gitee.com:myn_wsc/ng-x-table.git
myn_wsc
ng-x-table
ng-x-table
master

搜索帮助