Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
@@ -100,17 +100,6 @@ describe('drawerApi', () => {
|
||||
expect(onOpenChange).toHaveBeenCalledWith(true);
|
||||
});
|
||||
|
||||
it('should batch state updates', () => {
|
||||
const batchSpy = vi.spyOn(drawerApi.store, 'batch');
|
||||
drawerApi.batchStore(() => {
|
||||
drawerApi.setState({ title: 'Batch Title' });
|
||||
drawerApi.setState({ confirmText: 'Batch Confirm' });
|
||||
});
|
||||
expect(batchSpy).toHaveBeenCalled();
|
||||
expect(drawerApi.store.state.title).toBe('Batch Title');
|
||||
expect(drawerApi.store.state.confirmText).toBe('Batch Confirm');
|
||||
});
|
||||
|
||||
it('should call onClosed callback when provided', () => {
|
||||
const onClosed = vi.fn();
|
||||
const drawerApiWithHook = new DrawerApi({ onClosed });
|
||||
|
@@ -83,11 +83,6 @@ export class DrawerApi {
|
||||
bindMethods(this);
|
||||
}
|
||||
|
||||
// 如果需要多次更新状态,可以使用 batch 方法
|
||||
batchStore(cb: () => void) {
|
||||
this.store.batch(cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭弹窗
|
||||
*/
|
||||
|
@@ -1,9 +1,8 @@
|
||||
import type { ClassType } from '@vben-core/typings';
|
||||
import type { Component, Ref } from 'vue';
|
||||
|
||||
import type { DrawerApi } from './drawer-api';
|
||||
|
||||
import type { Component, Ref } from 'vue';
|
||||
|
||||
export type DrawerPlacement = 'bottom' | 'left' | 'right' | 'top';
|
||||
|
||||
export type CloseIconPlacement = 'left' | 'right';
|
||||
|
@@ -4,6 +4,7 @@ import type {
|
||||
ExtendedDrawerApi,
|
||||
} from './drawer';
|
||||
|
||||
import { useStore } from '@vben-core/shared/store';
|
||||
import {
|
||||
defineComponent,
|
||||
h,
|
||||
@@ -14,8 +15,6 @@ import {
|
||||
ref,
|
||||
} from 'vue';
|
||||
|
||||
import { useStore } from '@vben-core/shared/store';
|
||||
|
||||
import VbenDrawer from './drawer.vue';
|
||||
import { DrawerApi } from './drawer-api';
|
||||
|
||||
|
Reference in New Issue
Block a user