Web Demo Mobile Demo Angular Demo Vue Demo React Demo
源代码
import { Component } from '@angular/core';

@Component({
	selector: 'app-root',
	template: `
		<h2>Multiple ComboTree</h2>
		<eui-combotree style="width:300px"
				[(ngModel)]="value" 
				[data]="data" 
				[multiple]="true"
				[textFormatter]="formatText">
			<eui-tree></eui-tree>
		</eui-combotree>
		<p *ngIf="value">You selected: {{value}}</p>
	`
})
export class AppComponent {
	value: number[] = [122,124];

	data: any[] = [{
		"id":1,
		"text":"My Documents",
		"children":[{
			"id":11,
			"text":"Photos",
			"state":"closed",
			"children":[{
				"id":111,
				"text":"Friend"
			},{
				"id":112,
				"text":"Wife"
			},{
				"id":113,
				"text":"Company"
			}]
		},{
			"id":12,
			"text":"Program Files",
			"children":[{
				"id":121,
				"text":"Intel"
			},{
				"id":122,
				"text":"Java"
			},{
				"id":123,
				"text":"Microsoft Office"
			},{
				"id":124,
				"text":"Games"
			}]
		},{
			"id":13,
			"text":"index.html"
		},{
			"id":14,
			"text":"about.html"
		},{
			"id":15,
			"text":"welcome.html"
		}]
	}];

	formatText(value: string){
		if (this.value && this.value.length > 3){
			return this.value.length + ' nodes selected';
		}
		return value;
	}
}
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { EasyUIModule } from 'easyui/easyui/easyui.module';


import { AppComponent }   from './app.component';

@NgModule({
  bootstrap: [
    AppComponent
  ],
  declarations: [
    AppComponent
  ],
  imports: [
    FormsModule,
    BrowserModule,
    HttpModule,
    EasyUIModule
  ]
})
export class AppModule { }

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

enableProdMode();

platformBrowserDynamic().bootstrapModule(AppModule);