import { Component, OnInit } from '@angular/core'; import { Propertiy } from 'src/app/interface/propertiy-interface'; @Component({ selector: 'app-view-change-demo', templateUrl: './view-change-demo.component.html', styleUrls: ['./view-change-demo.component.scss'] }) export class ViewChangeDemoComponent implements OnInit { properties: Array = [ { name: 'toolbarData', value: '', type: '@Input()', description: '视图类型列表数组 其中对象中type类型需要唯一' }, { name: 'defaultType', value: 'string', type: '@Input()', description: '默认显示的视图类型,对应上述的type,如果没有传,默认展示第一种类型' }, { name: 'viewType', value: `tile || dropdown`, type: '@Input()', description: `默认是视图按钮平铺tile 可选参数'dropdown' 下拉选择视图` }, { name: 'toolTypeChange', value: ``, type: '@Output()', description: `当视图类型变化时触发,接受参数为当前选中视图的列表项` } ]; codePath = { baseDemo: 'assets/codes/view-change/basedemo', dropdownDemo:'assets/codes/view-change/dropdowndemo' }; toolbarIconData = [ { type: 'type1', url:'list-grid', title:'卡片视图', iconName:'f-icon f-icon-group' }, { type: 'type2', url:'list-echart', title:'图表视图', iconName:'f-icon f-icon-grid' }, { type: 'type3', url:'list-view', title:'列表视图', iconName:'f-icon f-icon-grid-layout' }, { type: 'type4', url:'list-card', title:'日历视图', iconName:'f-icon f-icon-ungroup' } ] toolbarIconData2 = [ { type: 'type11', url:'list-grid', title:'卡片视图', iconName:'f-icon f-icon-group' }, { type: 'type22', url:'list-echart', title:'图表视图', iconName:'f-icon f-icon-grid' }, { type: 'type33', url:'list-view', title:'列表视图', iconName:'f-icon f-icon-grid-layout', disable:'true' }, { type: 'type44', url:'list-card', title:'日历视图', iconName:'f-icon f-icon-ungroup' } ] currentType1 = 'type2'; currentType2 = 'type11'; constructor() { } ngOnInit() { } toolTypeChange(event){ //console.log(event); this.currentType1 = event.type; } toolTypeChange2(event){ //console.log(event); this.currentType2 = event.type; } }