UNPKG

ace-component

Version:

ace-components for ewms

59 lines (53 loc) 1.47 kB
import { Component, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; @Component({ selector: 'app-toaster-page', templateUrl: './toaster-page.component.html', styleUrls: ['./toaster-page.component.scss'], encapsulation: ViewEncapsulation.None }) export class ToasterPageComponent implements OnInit { @ViewChild('toaster') toaster; constructor() { } option = { title:'', body:'', type:'success' }; ngOnInit() { } thead = ['属性', '说明', '类型', '默认值']; tableValue = [ { name: 'type', text: 'success(绿色), warning(橙色), info(蓝色), error(红色)', type: 'string', default: 'success' }, { name: 'title', text: '标题', type: 'string', default: ' - ' }, { name: 'body', text: ' 文字 ', type: 'string', default: ' - ' } ]; getKeys(item: any) { return [item.name, item.text, item.type, item.default] } open(num){ switch(num){ case 1:this.option.type='success';this.option.title='标题';this.option.body='body';break; case 2:this.option.type='error';this.option.title='标题';this.option.body='body';break; case 3:this.option.type='warning';this.option.title='标题';this.option.body='body';break; case 4:this.option.type='info';this.option.title='标题';this.option.body='body';break; } setTimeout(()=>{ this.toaster.open(); },30) } }