Commit 20c10df846917f417919563f80454bc88a05a3de

Authored by wjc112233
Committed by GitHub
1 parent b11df08a

fix: 修改BasicForm表单的展开和收起按钮状态错误的bug (#2089) (#2109)

Co-authored-by: wjc <7098544231@qq.com>
src/components/Form/src/hooks/useAdvanced.ts
1 1 import type { ColEx } from '../types';
2 2 import type { AdvanceState } from '../types/hooks';
3   -import type { ComputedRef, Ref } from 'vue';
  3 +import { ComputedRef, getCurrentInstance, Ref } from 'vue';
4 4 import type { FormProps, FormSchema } from '../types/form';
5 5 import { computed, unref, watch } from 'vue';
6 6 import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';
... ... @@ -26,6 +26,8 @@ export default function ({
26 26 formModel,
27 27 defaultValueRef,
28 28 }: UseAdvancedContext) {
  29 + const vm = getCurrentInstance();
  30 +
29 31 const { realWidthRef, screenEnum, screenRef } = useBreakpoint();
30 32  
31 33 const getEmptySpan = computed((): number => {
... ... @@ -150,6 +152,9 @@ export default function ({
150 152 }
151 153 }
152 154  
  155 + // 确保页面发送更新
  156 + vm?.proxy?.$forceUpdate();
  157 +
153 158 advanceState.actionSpan = (realItemColSum % BASIC_COL_LEN) + unref(getEmptySpan);
154 159  
155 160 getAdvanced(unref(getProps).actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true);
... ...