fix: select diabled not work

pull/3053/head
tangjinzhou 2020-10-24 23:52:51 +08:00
parent f6953dc9a7
commit 59440f9207
2 changed files with 9 additions and 3 deletions

View File

@ -74,7 +74,7 @@ export default defineComponent({
size={fullscreen ? undefined : 'small'} size={fullscreen ? undefined : 'small'}
class={`${prefixCls}-year-select`} class={`${prefixCls}-year-select`}
onChange={this.onYearChange} onChange={this.onYearChange}
value={String(year)} value={year}
options={options} options={options}
getPopupContainer={() => this.calendarHeaderNode} getPopupContainer={() => this.calendarHeaderNode}
></Select> ></Select>

View File

@ -6,12 +6,18 @@ function convertNodeToOption(node: VNode): OptionData {
const { const {
key, key,
children, children,
props: { value, ...restProps }, props: { value, disabled, ...restProps },
} = node as VNode & { } = node as VNode & {
children: { default?: () => any }; children: { default?: () => any };
}; };
const child = children.default ? children.default() : undefined; const child = children.default ? children.default() : undefined;
return { key, value: value !== undefined ? value : key, children: child, ...restProps }; return {
key,
value: value !== undefined ? value : key,
children: child,
disabled: disabled || disabled === '', // support <a-select-option disabled />
...restProps,
};
} }
export function convertChildrenToData( export function convertChildrenToData(