fix(vue): fixed modal component failed to trigger update in vue@3.4.x (#7244)
* fix(vue): fixed modal component failed to trigger update in vue@3.4.x version * refactor: use cloneVNode trigger vNode updatepull/7207/merge
							parent
							
								
									8696e01039
								
							
						
					
					
						commit
						4ed2868137
					
				|  | @ -1,6 +1,6 @@ | |||
| import { filterEmpty } from './props-util'; | ||||
| import type { VNode, VNodeProps } from 'vue'; | ||||
| import { cloneVNode, isVNode } from 'vue'; | ||||
| import { cloneVNode, isVNode, render as VueRender } from 'vue'; | ||||
| import warning from './warning'; | ||||
| import type { RefObject } from './createRef'; | ||||
| type NodeProps = Record<string, any> & | ||||
|  | @ -51,3 +51,7 @@ export function deepCloneElement<T, U>( | |||
|     return cloned; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export function triggerVNodeUpdate(vm: VNode, attrs: Record<string, any>, dom: any) { | ||||
|   VueRender(cloneVNode(vm, { ...attrs }), dom); | ||||
| } | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ import ConfirmDialog from './ConfirmDialog'; | |||
| import type { ModalFuncProps } from './Modal'; | ||||
| import ConfigProvider, { globalConfigForApi } from '../config-provider'; | ||||
| import omit from '../_util/omit'; | ||||
| import { triggerVNodeUpdate } from '../_util/vnode'; | ||||
| 
 | ||||
| import { getConfirmLocale } from './locale'; | ||||
| import destroyFns from './destroyFns'; | ||||
|  | @ -70,8 +71,7 @@ const confirm = (config: ModalFuncProps) => { | |||
|       }; | ||||
|     } | ||||
|     if (confirmDialogInstance) { | ||||
|       Object.assign(confirmDialogInstance.component.props, currentConfig); | ||||
|       confirmDialogInstance.component.update(); | ||||
|       triggerVNodeUpdate(confirmDialogInstance, currentConfig, container); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 cc heart
						cc heart