mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 12:58:38 +08:00
chore: combo 的 tabsMode 如果值为空不显示新增按钮问题修复 (#3620)
* chore: combo 的 tabsMode 如果值为空不显示新增按钮问题修复 * 用例报错修复 * 尝试修复用例报错
This commit is contained in:
parent
b5d8143971
commit
c1ed0cf935
@ -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();
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user