-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(abc:simplate-table): add reset method
- Loading branch information
Showing
5 changed files
with
90 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
order: 3 | ||
title: 搜索表单 | ||
--- | ||
|
||
配合 `load()` & `reset()` 完成搜索表单。 | ||
|
||
```ts | ||
import { Component } from '@angular/core'; | ||
import { SimpleTableColumn } from '@delon/abc'; | ||
|
||
@Component({ | ||
selector: 'app-demo', | ||
template: ` | ||
<div class="mb-md"> | ||
<nz-input [(ngModel)]="params.name" name="name" nzPlaceHolder="请输入姓名" style="width: 100px"></nz-input> | ||
<button nz-button (click)="st.load(1)" [nzType]="'primary'">搜索</button> | ||
<button nz-button (click)="params = {}; st.reset()">重置</button> | ||
</div> | ||
<simple-table #st [data]="url" [extraParams]="params" [total]="total" [columns]="columns" | ||
[resReName]="{list: 'results' }"></simple-table> | ||
` | ||
}) | ||
export class DemoComponent { | ||
url = `https://randomuser.me/api/?results=3`; | ||
params: any = { name: 'asdf' }; | ||
// mock | ||
total = 100; | ||
columns: SimpleTableColumn[] = [ | ||
{ title: '编号', index: 'id.value' }, | ||
{ title: '头像', type: 'img', width: '50px', index: 'picture.thumbnail' }, | ||
{ title: '邮箱', index: 'email' }, | ||
{ title: '电话', index: 'phone' }, | ||
{ title: '注册时间', type: 'date', index: 'registered' } | ||
]; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters