avancement planning
This commit is contained in:
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
|
||||
.change-options {
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
Generated
Vendored
+1
-4
@@ -1,4 +1 @@
|
||||
|
||||
<nz-cascader [nzOptions]="nzOptions" [(ngModel)]="values" (ngModelChange)="onChanges($event)"></nz-cascader>
|
||||
<a (click)="changeNzOptions()" class="change-options">Change Options</a>
|
||||
|
||||
<nz-cascader [nzOptions]="nzOptions" [(ngModel)]="values" (ngModelChange)="onChanges($event)" />
|
||||
Generated
Vendored
+4
-65
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { NzCascaderModule, NzCascaderOption } from 'ng-zorro-antd/cascader';
|
||||
@@ -45,76 +45,15 @@ const options: NzCascaderOption[] = [
|
||||
}
|
||||
];
|
||||
|
||||
const otherOptions: NzCascaderOption[] = [
|
||||
{
|
||||
value: 'fujian',
|
||||
label: 'Fujian',
|
||||
children: [
|
||||
{
|
||||
value: 'xiamen',
|
||||
label: 'Xiamen',
|
||||
children: [
|
||||
{
|
||||
value: 'Kulangsu',
|
||||
label: 'Kulangsu',
|
||||
isLeaf: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: 'guangxi',
|
||||
label: 'Guangxi',
|
||||
children: [
|
||||
{
|
||||
value: 'guilin',
|
||||
label: 'Guilin',
|
||||
children: [
|
||||
{
|
||||
value: 'Lijiang',
|
||||
label: 'Li Jiang River',
|
||||
isLeaf: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: '<%= selector %>',
|
||||
imports: [FormsModule, NzCascaderModule],
|
||||
<% if(inlineTemplate) { %>template: `
|
||||
<nz-cascader [nzOptions]="nzOptions" [(ngModel)]="values" (ngModelChange)="onChanges($event)"></nz-cascader>
|
||||
<a (click)="changeNzOptions()" class="change-options">Change Options</a>
|
||||
`<% } else { %>templateUrl: './<%= dasherize(name) %>.component.html'<% } %>,
|
||||
<% if(inlineStyle) { %>styles: [`
|
||||
.change-options {
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
`]<% } else { %>styleUrls: ['./<%= dasherize(name) %>.component.<%= style %>']<% } %>
|
||||
<% if(inlineTemplate) { %>template: `<nz-cascader [nzOptions]="nzOptions" [(ngModel)]="values" (ngModelChange)="onChanges($event)" />`<% } else { %>templateUrl: './<%= dasherize(name) %>.component.html'<% } %>
|
||||
})
|
||||
export class <%= classify(name) %>Component implements OnInit {
|
||||
nzOptions: NzCascaderOption[] | null = null;
|
||||
export class <%= classify(name) %>Component {
|
||||
readonly nzOptions: NzCascaderOption[] = options;
|
||||
values: string[] | null = null;
|
||||
|
||||
ngOnInit(): void {
|
||||
setTimeout(() => {
|
||||
this.nzOptions = options;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
changeNzOptions(): void {
|
||||
if (this.nzOptions === options) {
|
||||
this.nzOptions = otherOptions;
|
||||
} else {
|
||||
this.nzOptions = options;
|
||||
}
|
||||
}
|
||||
|
||||
onChanges(values: string): void {
|
||||
console.log(values, this.values);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user