We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vben Admin V5
useVbenVxeGrid在销毁/重建后表单依旧为上次数据
影响功能: 在modal/drawer中的表格 第二次打开无法查询数据(依旧为上一次表单数据)及使用v-if切换
<script> const init = ref(true); async function mockLoadTable() { init.value = false; await nextTick(); init.value = true; } </script> <template> <Page auto-content-height> <Button @click="mockLoadTable">模拟重新加载</Button> <Grid v-if="init" /> <ModalTable /> </Page> </template>
使用v-if来模拟组件加载/卸载 第一次点击查询 模拟加载后再次点击依旧为上一次表单的值
useVbenVxeGrid const Grid = defineComponent( (props: VxeGridProps, { attrs, slots }) => { onBeforeUnmount(() => { api.unmount(); }); api.setState({ ...props, ...attrs }); console.log('表单的值:', extendedApi.formApi.form?.values); return () => h(VxeGrid, { ...props, ...attrs, api: extendedApi }, slots); }, { inheritAttrs: false, name: 'VbenVxeGrid', }, );
win11
No response
The text was updated successfully, but these errors were encountered:
相关issue #4752 #4785
Sorry, something went wrong.
组件销毁重建 闭包引用的外部的extendedApi一直为第一次初始化的值
export function useVbenVxeGrid(options: VxeGridProps) { // const IS_REACTIVE = isReactive(options); const api = new VxeGridApi(options); const extendedApi: ExtendedVxeGridApi = api as ExtendedVxeGridApi; extendedApi.useStore = (selector) => { return useStore(api.store, selector); }; const Grid = defineComponent( (props: VxeGridProps, { attrs, slots }) => { onBeforeUnmount(() => { api.unmount(); }); api.setState({ ...props, ...attrs }); // 这里的api不论组件怎么销毁重建依旧为第一次的值 return () => h(VxeGrid, { ...props, ...attrs, api: extendedApi }, slots); },
Successfully merging a pull request may close this issue.
Version
Vben Admin V5
Describe the bug?
useVbenVxeGrid在销毁/重建后表单依旧为上次数据
影响功能: 在modal/drawer中的表格 第二次打开无法查询数据(依旧为上一次表单数据)及使用v-if切换
Reproduction
使用v-if来模拟组件加载/卸载
第一次点击查询
模拟加载后再次点击依旧为上一次表单的值
System Info
Relevant log output
No response
Validations
The text was updated successfully, but these errors were encountered: