Skip to content

Commit

Permalink
feat(readme): 完善readme,使用方式改变 app-tag-manager => ngx-tag-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyinchao committed Jan 14, 2020
1 parent 2202070 commit ea2a880
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
8 changes: 5 additions & 3 deletions README.md
@@ -1,4 +1,4 @@
## 1.0.4 (2020-01-14)
## 1.0.5 (2020-01-14)


### Features
Expand Down Expand Up @@ -37,8 +37,8 @@ import { TagManagerComponent } from 'ngx-tag-manager';
<span>标签管理</span>
</button>
<app-tag-manager [show]="showTagManager" label="标签" [listApi]="api.getTagList"
[saveApi]="api.saveTag" [deleteApi]="api.deleteTag" (closeEvent)="showTagManager=false"></app-tag-manager>
<ngx-tag-manager [show]="showTagManager" label="标签" [listApi]="api.getTagList"
[saveApi]="api.saveTag" [deleteApi]="api.deleteTag" (closeEvent)="showTagManager=false"></ngx-tag-manager>
```

### API
Expand All @@ -49,6 +49,8 @@ import { TagManagerComponent } from 'ngx-tag-manager';

label: 弹窗文案控制,默认“标签”,如果用于岗位管理,则传入“岗位”,弹窗文案会变为岗位管理,新增岗位等等

cate: 分类,标识哪一类标签,比如可以是文章的标签,也可以是岗位的标签

listApi: 标签列表接口

saveApi: 新增或修改标签接口
Expand Down
19 changes: 9 additions & 10 deletions tag-manager/component.ts
@@ -1,4 +1,3 @@
// @ts-nocheck
import {
Component,
EventEmitter,
Expand All @@ -20,10 +19,10 @@ import {
selectedRow,
selectedRows,
total
} from "./interfaces";
} from "./interface";

@Component({
selector: "app-tag-manager",
selector: "ngx-tag-manager",
templateUrl: "./index.html",
styles: []
})
Expand Down Expand Up @@ -81,16 +80,16 @@ export class TagManagerComponent implements OnInit, OnChanges {
private cdr: ChangeDetectorRef
) {}

ngOnInit() {
ngOnInit(): any {
this.columns[0].title = this.label;
}

ngOnChanges(e) {
ngOnChanges(e): any {
this.isVisible = e && e.show && e.show.currentValue;
this.isVisible && this.getTagData();
}

getTagData() {
getTagData(): any {
this.loading = true;
this.listApi({ noticeCate: this.noticeCate }).subscribe(res => {
this.loading = false;
Expand All @@ -99,7 +98,7 @@ export class TagManagerComponent implements OnInit, OnChanges {
});
}

tagStChange(e: STChange) {
tagStChange(e: STChange): any {
switch (e.type) {
case "filter":
this.getTagData();
Expand All @@ -114,7 +113,7 @@ export class TagManagerComponent implements OnInit, OnChanges {
}
}

addOrEditTag(tpl: TemplateRef<{}>, type: "add" | "edit") {
addOrEditTag(tpl: TemplateRef<{}>, type: "add" | "edit"): any {
if (type === "add") {
this.agoName = undefined;
}
Expand Down Expand Up @@ -146,7 +145,7 @@ export class TagManagerComponent implements OnInit, OnChanges {
});
}

checkTagValid() {
checkTagValid(): boolean {
const { name } = this.selectedRow;
if (!name) {
this.msg.info("请输入" + this.label + "名称");
Expand All @@ -155,7 +154,7 @@ export class TagManagerComponent implements OnInit, OnChanges {
return true;
}

deleteTag() {
deleteTag(): any {
this.modalSrv.confirm({
nzTitle: "是否确定删除该项?",
nzOkType: "danger",
Expand Down

0 comments on commit ea2a880

Please sign in to comment.