ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
83 lines (73 loc) • 2 kB
text/typescript
import {Component, ViewChild, TemplateRef} from '@angular/core';
const options = [{
value: 'zhejiang',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: 'West Lake',
code: 752100,
isLeaf: true
}],
}, {
value: 'ningbo',
label: 'Ningbo',
isLeaf: true
}],
}, {
value: 'jiangsu',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: 'Zhong Hua Men',
code: 453400,
isLeaf: true
}],
}],
}];
export class NzDemoCascaderCustomRenderComponent {
/** init data */
_options = options;
_value: any[] = null;
tpl: TemplateRef<any>;
_console(value) {
console.log(value);
}
get _displayRender(): Function {
return this.displayRender.bind(this);
}
displayRender(labels: string[], selectedOptions: any[]): any {
return this.tpl;
}
handleAreaClick(e: Event, label: string, option: any): void {
e.preventDefault();
e.stopPropagation();
console.log('clicked', label, option);
}
}