tag-select 标签选择器 - 图1 This article has not been translated, hope that your can PR to translated it. Help us!tag-select 标签选择器 - 图2

tag-select 标签选择器

增加标签的展开与收进功能。

  1. import { TagSelectModule } from '@delon/abc/tag-select';

代码演示

tag-select 标签选择器 - 图3

基础样例

结合 nz-checkable-tagtag-select 组件,方便的应用于筛选类目的业务场景中。

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'components-tag-select-simple',
  4. template: `
  5. <tag-select>
  6. <nz-tag *ngFor="let i of categories; let idx = index" nzMode="checkable"
  7. [(nzChecked)]="i.value" (nzCheckedChange)="change(i)">{{i.text}}</nz-tag>
  8. </tag-select>
  9. `
  10. })
  11. export class ComponentsTagSelectSimpleComponent {
  12. categories = [
  13. { id: 0, text: '全部', value: false },
  14. { id: 1, text: '类目一', value: false },
  15. { id: 2, text: '类目二', value: false },
  16. { id: 3, text: '类目三', value: false },
  17. { id: 4, text: '类目四', value: false },
  18. { id: 5, text: '类目五', value: false },
  19. { id: 6, text: '类目六', value: false },
  20. { id: 7, text: '类目七', value: false },
  21. { id: 8, text: '类目八', value: false },
  22. { id: 9, text: '类目九', value: false },
  23. { id: 10, text: '类目十', value: false },
  24. { id: 11, text: '类目十一', value: false },
  25. { id: 12, text: '类目十二', value: false },
  26. { id: 13, text: '类目十三', value: false },
  27. { id: 14, text: '类目十四', value: false },
  28. { id: 15, text: '类目十五', value: false }
  29. ];
  30. change(res: any) {
  31. if (res.id !== 0) return;
  32. this.categories.forEach(i => i.value = res.value);
  33. }
  34. }

API

tag-select

成员说明类型默认值
[expandable]是否启用 展开与收进booleantrue
(change)展开与收进回调函数,参数:booleanEventEmitter<boolean>-