import { Component, OnInit, Type } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; import { Propertiy } from 'src/app/interface/propertiy-interface'; @Component({ selector: 'app-tag-demo', templateUrl: './tag-demo.component.html', styleUrls: ['./tag-demo.component.scss'] }) export class TagDemoComponent implements OnInit { tags1 = 'tag1,tag2,tag3'; tagsNew2 = 'tag1,tag2,tag3'; tags3 = '足球,排球,篮球,乒乓球'; tags4 = ''; formGroup = new FormGroup({ tags: new FormControl('tag1,tag2,tag3') }) codePath = { baseDemo: 'assets/codes/tag/base', readonly: 'assets/codes/tag/readonly', typeDemo: 'assets/codes/tag/type', colorDemo: 'assets/codes/tag/color', checkableDemo: 'assets/codes/tag/checkable', addableDemo: 'assets/codes/tag/addable', formDemo: 'assets/codes/tag/form' }; properties: Array = [ { name: 'data', value: 'string', type: '@Input()', description: '标签,用,隔开' }, { name: 'readonly', value: 'boolean', type: '@Input()', description: '是否只读 默认false' }, // { // name: 'addable', // value: 'boolean', // type: '@Input()', // description: '是否允许添加标签,默认值false' // }, // { // name: 'checkable', // value: 'boolean', // type: '@Input()', // description: '是否支持选择,默认值false' // }, { name: 'className', value: 'string', type: '@Input()', description: '自定义类名' }, { name: 'tagType', value: 'string', type: '@Input()', description: '标签类型,内置类型 success info error warning' }, { name: 'closable', value: 'boolean', type: '@Input()', description: '标签是否支持删除,默认值false' }, { name: 'color', value: 'string', type: '@Input()', description: '自定义颜色' }, { name: 'checkedChange', value: ``, type: '@Output()', description: `允许选择时,选择变化` }, { name: 'tagCheckedChange', value: ``, type: '@Output()', description: `允许选择时,某个标签选择变化` }, { name: 'tagChange', value: ``, type: '@Output()', description: `标签数量发生变化(删除、增加)` }, { name: 'closeTag', value: ``, type: '@Output()', description: `关闭某个标签时变化` } ]; constructor() { } ngOnInit() { } closeHandler(e) { console.log(e); } CheckChanged(e){ console.log(e); } tagChangehandler(e) { console.log(e); } closeTaghandler(e) { console.log(e); } color = '#f40'; type = 'success'; changeColor(){ this.color = '#576'; } changetype() { this.type = 'warning'; } }