fix: fixed some style issues (#4379)
This commit is contained in:
@@ -10,7 +10,19 @@ import type { FormActions, VbenFormProps } from './types';
|
||||
import { toRaw } from 'vue';
|
||||
|
||||
import { Store } from '@vben-core/shared/store';
|
||||
import { bindMethods, isFunction, StateHandler } from '@vben-core/shared/utils';
|
||||
import {
|
||||
bindMethods,
|
||||
createMerge,
|
||||
isFunction,
|
||||
StateHandler,
|
||||
} from '@vben-core/shared/utils';
|
||||
|
||||
const merge = createMerge((originObj, key, updates) => {
|
||||
if (Array.isArray(originObj[key]) && Array.isArray(updates)) {
|
||||
originObj[key] = updates;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function getDefaultState(): VbenFormProps {
|
||||
return {
|
||||
@@ -138,9 +150,11 @@ export class FormApi {
|
||||
| Partial<VbenFormProps>,
|
||||
) {
|
||||
if (isFunction(stateOrFn)) {
|
||||
this.store.setState(stateOrFn as (prev: VbenFormProps) => VbenFormProps);
|
||||
this.store.setState((prev) => {
|
||||
return merge(stateOrFn(prev), prev);
|
||||
});
|
||||
} else {
|
||||
this.store.setState((prev) => ({ ...prev, ...stateOrFn }));
|
||||
this.store.setState((prev) => merge(stateOrFn, prev));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ export function useExpandable(props: FormRenderProps) {
|
||||
for (let index = 1; index <= rows; index++) {
|
||||
maxItem += mapping?.[index] ?? 0;
|
||||
}
|
||||
return maxItem - 1;
|
||||
return maxItem - 1 || 1;
|
||||
});
|
||||
|
||||
watch(
|
||||
@@ -50,11 +50,11 @@ export function useExpandable(props: FormRenderProps) {
|
||||
return;
|
||||
}
|
||||
// 小屏幕不计算
|
||||
if (breakpoints.smaller('sm').value) {
|
||||
// 保持一行
|
||||
rowMapping.value = { 1: 2 };
|
||||
return;
|
||||
}
|
||||
// if (breakpoints.smaller('sm').value) {
|
||||
// // 保持一行
|
||||
// rowMapping.value = { 1: 2 };
|
||||
// return;
|
||||
// }
|
||||
|
||||
const formItems = [...wrapperRef.value.children];
|
||||
|
||||
|
Reference in New Issue
Block a user