import { Component, OnInit } from '@angular/core'; import { Code } from './../../code/selectButton'; @Component({ templateUrl: './selectButton.component.html' }) export class SelectButtonComponent implements OnInit { code = Code; headers: any[]; parameters: any[]; eventHeader: any[]; eventValue: any[]; cities1: any[]; cities2: any[]; selectedCity1: any[]; selectedCity2: any[]; cities: any[]; selectedCities: string[] = []; types: any[]; selectedType: string; constructor() { this.cities1 = [ {label:'Select City', value:null}, {label:'New York', value:{id:1, name: 'New York', code: 'NY'}}, {label:'Rome', value:{id:2, name: 'Rome', code: 'RM'}}, {label:'London', value:{id:3, name: 'London', code: 'LDN'}}, {label:'Istanbul', value:{id:4, name: 'Istanbul', code: 'IST'}}, {label:'Paris', value:{id:5, name: 'Paris', code: 'PRS'}} ]; //An array of cities this.cities2 = [ {name: 'New York', code: 'NY'}, {name: 'Rome', code: 'RM'}, {name: 'London', code: 'LDN'}, {name: 'Istanbul', code: 'IST'}, {name: 'Paris', code: 'PRS'} ]; this.cities = []; this.cities.push({label:'New York', value:'New York'}); this.cities.push({label:'Rome', value:'Rome'}); this.cities.push({label:'London', value:'London'}); this.cities.push({label:'Istanbul', value:'Istanbul'}); this.cities.push({label:'Paris', value:'Paris'}); this.types = []; this.types.push({title: 'Paypal', value: 'PayPal', icon: 'fa ion-monitor'}); this.types.push({title: 'Visa', value: 'Visa', icon: 'fa ion-iphone'}); this.types.push({title: 'MasterCard', value: 'MasterCard', icon: 'fa ion-ipod'}); this.headers = [ {name : "名字"}, {name : "类型"}, {name : "默认"}, {name : "描述"} ]; this.parameters = [ {name: "options",type: "array",default: "null",des: "一个数组selectitems显示可用的选项。"}, {name: "optionLabel",type: "string",default: "null",des: "标签的名字作为选项而不是SelectItems"}, {name: "multiple",type: "boolean",default: "false",des: "该属性被指定的时候,允许多选。"}, {name: "tabindex",type: "number",default: "null",des: "列表中元素索引。"}, {name: "style",type: "string",default: "null",des: "组件内联样式。"}, {name: "styleClass",type: "string",default: "null",des: "组件的行内样式。"}, {name: "disabled",type: "boolean",default: "false ",des: "该属性被指定的时候,被指定的元素不可用。"}, {name: "dataKey",type: "string",default: "null ",des: "在选项中的唯一标识。"} ]; this.eventHeader = [ {name : "名字"}, {name : "参数"}, {name : "描述"} ]; this.eventValue = [ {name : "onChange",param : "1.事件: 浏览器事件 2.事件的值: 一个或者多个被选中的值",event :"当值改变时回调onChange事件" }, {name : "onOptionClick",param : "1.事件: 浏览器事件 2.事件选项: 被点击的按钮是SelectItem的实例 3.索引: 被点击按钮的索引",event:"当按钮被点击时回调onOptionClick事件"} ]; } ngOnInit() {} }