Closed limingyao-xx closed 6 years ago
`@ViewChild('sf') sf: FormComponent; schema: SFSchema = { properties: { app: { type: 'string', title: '附属应用', widget: 'select', enum: [] } } };
ngOnInit() { this.http.get('/apps').subscribe((res: any) => { this.schema.properties.app.enum = res; this.sf.refreshSchema(); }); }`
采用这种方式设置default后,select的宽度变小。如图:
这是 ng-zorro-antd 的一个样式BUG,所以最好在 schema 的 widgets 中指定 style 内容即可。
style
测试了下,设置widget的style:‘width:200px’有效,但设置百分比无效。还有其它方案么?
据我所知,没有。
`@ViewChild('sf') sf: FormComponent; schema: SFSchema = { properties: { app: { type: 'string', title: '附属应用', widget: 'select', enum: [] } } };
ngOnInit() { this.http.get('/apps').subscribe((res: any) => { this.schema.properties.app.enum = res; this.sf.refreshSchema(); }); }`
采用这种方式设置default后,select的宽度变小。如图: