chore: bump 2.0.0-rc.11

This commit is contained in:
vben
2020-11-18 23:47:32 +08:00
parent be2b8a7e17
commit ea24dfa384
10 changed files with 59 additions and 71 deletions

View File

@@ -7,8 +7,7 @@ export interface DrawerInstance {
}
export interface ReturnMethods extends DrawerInstance {
openDrawer: <T = any>(visible?: boolean, data?: T) => void;
transferDrawerData: (data: any) => void;
openDrawer: <T = any>(visible?: boolean, data?: T, openOnSet?: boolean) => void;
}
export type RegisterFn = (drawerInstance: DrawerInstance, uuid?: string) => void;
@@ -17,7 +16,6 @@ export interface ReturnInnerMethods extends DrawerInstance {
closeDrawer: () => void;
changeLoading: (loading: boolean) => void;
changeOkLoading: (loading: boolean) => void;
receiveDrawerDataRef: any;
}
export type UseDrawerReturnType = [RegisterFn, ReturnMethods];

View File

@@ -6,16 +6,7 @@ import type {
UseDrawerInnerReturnType,
} from './types';
import {
ref,
getCurrentInstance,
onUnmounted,
unref,
reactive,
computed,
watchEffect,
nextTick,
} from 'vue';
import { ref, getCurrentInstance, onUnmounted, unref, reactive, watchEffect, nextTick } from 'vue';
import { isProdMode } from '/@/utils/env';
import { isFunction } from '/@/utils/is';
@@ -60,18 +51,19 @@ export function useDrawer(): UseDrawerReturnType {
getInstance().setDrawerProps(props);
},
openDrawer: <T = any>(visible = true, data?: T): void => {
openDrawer: <T = any>(visible = true, data?: T, openOnSet = false): void => {
getInstance().setDrawerProps({
visible: visible,
});
if (data) {
dataTransferRef[unref(uidRef)] = data;
dataTransferRef[unref(uidRef)] = openOnSet
? {
...data,
__t__: Date.now(),
}
: data;
}
},
transferDrawerData(val: any) {
dataTransferRef[unref(uidRef)] = val;
},
};
return [getDrawer, methods];
@@ -111,10 +103,6 @@ export const useDrawerInner = (callbackFn?: Fn): UseDrawerInnerReturnType => {
return [
register,
{
receiveDrawerDataRef: computed(() => {
return dataTransferRef[unref(uidRef)];
}),
changeLoading: (loading = true) => {
getInstance().setDrawerProps({ loading });
},

View File

@@ -9,8 +9,7 @@ export interface ModalMethods {
export type RegisterFn = (modalMethods: ModalMethods, uuid?: string) => void;
export interface ReturnMethods extends ModalMethods {
openModal: <T = any>(props?: boolean, data?: T) => void;
transferModalData: (data: any) => void;
openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void;
}
export type UseModalReturnType = [RegisterFn, ReturnMethods];
@@ -18,7 +17,6 @@ export interface ReturnInnerMethods extends ModalMethods {
closeModal: () => void;
changeLoading: (loading: boolean) => void;
changeOkLoading: (loading: boolean) => void;
receiveModalDataRef: any;
}
export type UseModalInnerReturnType = [RegisterFn, ReturnInnerMethods];

View File

@@ -5,16 +5,7 @@ import type {
ReturnMethods,
UseModalInnerReturnType,
} from './types';
import {
ref,
onUnmounted,
unref,
getCurrentInstance,
reactive,
computed,
watchEffect,
nextTick,
} from 'vue';
import { ref, onUnmounted, unref, getCurrentInstance, reactive, watchEffect, nextTick } from 'vue';
import { isProdMode } from '/@/utils/env';
import { isFunction } from '/@/utils/is';
const dataTransferRef = reactive<any>({});
@@ -55,18 +46,19 @@ export function useModal(): UseModalReturnType {
getInstance().setModalProps(props);
},
openModal: <T = any>(visible = true, data?: T): void => {
openModal: <T = any>(visible = true, data?: T, openOnSet = false): void => {
getInstance().setModalProps({
visible: visible,
});
if (data) {
dataTransferRef[unref(uidRef)] = data;
dataTransferRef[unref(uidRef)] = openOnSet
? {
...data,
__t__: Date.now(),
}
: data;
}
},
transferModalData(val: any) {
dataTransferRef[unref(uidRef)] = val;
},
};
return [register, methods];
}
@@ -106,10 +98,6 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => {
return [
register,
{
receiveModalDataRef: computed(() => {
return dataTransferRef[unref(uidRef)];
}),
changeLoading: (loading = true) => {
getInstance().setModalProps({ loading });
},