chore: combo 的 tabsMode 如果值为空不显示新增按钮问题修复 (#3620)

* chore: combo 的 tabsMode 如果值为空不显示新增按钮问题修复

* 用例报错修复

* 尝试修复用例报错
This commit is contained in:
liaoxuezhi 2022-02-21 17:06:09 +08:00 committed by GitHub
parent b5d8143971
commit c1ed0cf935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -73,17 +73,17 @@ test('options:linkage', async () => {
expect(container).toMatchSnapshot();
fireEvent.click(getByText('选项1'));
await wait(300);
await wait(600);
expect(container).toMatchSnapshot();
fireEvent.click(getByText('选项2'));
await wait(300);
await wait(600);
expect(container).toMatchSnapshot();
fireEvent.click(getByText('选项3'));
await wait(300);
await wait(600);
expect(container).toMatchSnapshot();
});

View File

@ -338,7 +338,7 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
const parentTree = this.getParentTree(option, [option]);
const scrollLeft = (parentTree.length - 2) * tabWidth;
if (scrollLeft !== 0) {
(this.tabsRef.current as HTMLElement).scrollTo(scrollLeft, 0);
(this.tabsRef.current as HTMLElement)?.scrollTo(scrollLeft, 0);
}
});

View File

@ -932,7 +932,7 @@ export default class ComboControl extends React.Component<ComboProps> {
removable !== false; // 是否可以删除
if (!Array.isArray(value)) {
return this.renderPlaceholder();
value = []; // 让 tabs 输出,否则会没有新增按钮。
}
// todo 支持拖拽排序。
@ -987,7 +987,7 @@ export default class ComboControl extends React.Component<ComboProps> {
) : null
}
>
{value.map((value, index) => {
{value.map((value: any, index: number) => {
const data = this.formatValue(value, index);
let condition: ComboCondition | null | undefined = null;
let toolbar = undefined;