Commit 20c10df846917f417919563f80454bc88a05a3de
Committed by
GitHub
1 parent
b11df08a
fix: 修改BasicForm表单的展开和收起按钮状态错误的bug (#2089) (#2109)
Co-authored-by: wjc <7098544231@qq.com>
Showing
1 changed file
with
6 additions
and
1 deletions
src/components/Form/src/hooks/useAdvanced.ts
1 | import type { ColEx } from '../types'; | 1 | import type { ColEx } from '../types'; |
2 | import type { AdvanceState } from '../types/hooks'; | 2 | import type { AdvanceState } from '../types/hooks'; |
3 | -import type { ComputedRef, Ref } from 'vue'; | 3 | +import { ComputedRef, getCurrentInstance, Ref } from 'vue'; |
4 | import type { FormProps, FormSchema } from '../types/form'; | 4 | import type { FormProps, FormSchema } from '../types/form'; |
5 | import { computed, unref, watch } from 'vue'; | 5 | import { computed, unref, watch } from 'vue'; |
6 | import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is'; | 6 | import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is'; |
@@ -26,6 +26,8 @@ export default function ({ | @@ -26,6 +26,8 @@ export default function ({ | ||
26 | formModel, | 26 | formModel, |
27 | defaultValueRef, | 27 | defaultValueRef, |
28 | }: UseAdvancedContext) { | 28 | }: UseAdvancedContext) { |
29 | + const vm = getCurrentInstance(); | ||
30 | + | ||
29 | const { realWidthRef, screenEnum, screenRef } = useBreakpoint(); | 31 | const { realWidthRef, screenEnum, screenRef } = useBreakpoint(); |
30 | 32 | ||
31 | const getEmptySpan = computed((): number => { | 33 | const getEmptySpan = computed((): number => { |
@@ -150,6 +152,9 @@ export default function ({ | @@ -150,6 +152,9 @@ export default function ({ | ||
150 | } | 152 | } |
151 | } | 153 | } |
152 | 154 | ||
155 | + // 确保页面发送更新 | ||
156 | + vm?.proxy?.$forceUpdate(); | ||
157 | + | ||
153 | advanceState.actionSpan = (realItemColSum % BASIC_COL_LEN) + unref(getEmptySpan); | 158 | advanceState.actionSpan = (realItemColSum % BASIC_COL_LEN) + unref(getEmptySpan); |
154 | 159 | ||
155 | getAdvanced(unref(getProps).actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true); | 160 | getAdvanced(unref(getProps).actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true); |