✏️ 完善类型

This commit is contained in:
BTMuli
2023-10-26 13:31:26 +08:00
parent f84c4b93ea
commit 90872a4917
4 changed files with 7 additions and 25 deletions

View File

@@ -13,14 +13,14 @@ const confirmId = "tg-func-confirm";
/** /**
* @description 自定义 confirm 组件 * @description 自定义 confirm 组件
* @since Beta v0.3.3 * @since Beta v0.3.4
* @extends ComponentInternalInstance * @extends ComponentInternalInstance
* @property {Function} exposeProxy.displayBox 显示 confirm * @property {Function} exposeProxy.displayBox 显示 confirm
* @return ConfirmInstance * @return ConfirmInstance
*/ */
interface ConfirmInstance extends ComponentInternalInstance { interface ConfirmInstance extends ComponentInternalInstance {
exposeProxy: { exposeProxy: {
displayBox: typeof TGApp.Component.Confirm.displayBox; displayBox: (props: TGApp.Component.Confirm.Params) => Promise<string | boolean>;
}; };
} }
@@ -41,7 +41,7 @@ async function showConfirm(props: TGApp.Component.Confirm.Params): Promise<strin
async function showConfirm(props: TGApp.Component.Confirm.Params): Promise<string | boolean> { async function showConfirm(props: TGApp.Component.Confirm.Params): Promise<string | boolean> {
if (confirmInstance !== undefined) { if (confirmInstance !== undefined) {
const boxVue = <ConfirmInstance>confirmInstance.component; const boxVue = <ConfirmInstance>confirmInstance.component;
return boxVue.exposeProxy.displayBox(props); return await boxVue.exposeProxy.displayBox(props);
} else { } else {
confirmInstance = renderBox(props); confirmInstance = renderBox(props);
return await showConfirm(props); return await showConfirm(props);

View File

@@ -1,7 +1,7 @@
/** /**
* @file component func snackbar.ts * @file component func snackbar.ts
* @description 封装 vuetify 的 snackbar 组件,通过函数调用的方式,简化 snackbar 的使用 * @description 封装 vuetify 的 snackbar 组件,通过函数调用的方式,简化 snackbar 的使用
* @since Beta v0.3.3 * @since Beta v0.3.4
*/ */
import type { ComponentInternalInstance, VNode } from "vue"; import type { ComponentInternalInstance, VNode } from "vue";
@@ -20,7 +20,7 @@ const snackbarId = "tg-func-snackbar";
*/ */
interface SnackbarInstance extends ComponentInternalInstance { interface SnackbarInstance extends ComponentInternalInstance {
exposeProxy: { exposeProxy: {
displayBox: typeof TGApp.Component.Snackbar.displayBox; displayBox: (props: TGApp.Component.Snackbar.Params) => void;
}; };
} }

View File

@@ -1,7 +1,7 @@
/** /**
* @file types Component Confirm.d.ts * @file types Component Confirm.d.ts
* @description Component Confirm 类型声明文件 * @description Component Confirm 类型声明文件
* @since Beta v0.3.3 * @since Beta v0.3.4
*/ */
declare namespace TGApp.Component.Confirm { declare namespace TGApp.Component.Confirm {
@@ -53,13 +53,4 @@ declare namespace TGApp.Component.Confirm {
* @return Params * @return Params
*/ */
type Params = ParamsConfirm | ParamsInput; type Params = ParamsConfirm | ParamsInput;
/**
* @description Confirm 方法 - displayBox
* @since Beta v0.3.3
* @function displayBox
* @param {Params} props
* @return string | boolean
*/
function displayBox(props: Params): boolean | string;
} }

View File

@@ -1,7 +1,7 @@
/** /**
* @file types Component Snackbar.d.ts * @file types Component Snackbar.d.ts
* @description Component Snackbar 类型声明文件 * @description Component Snackbar 类型声明文件
* @since Beta v0.3.3 * @since Beta v0.3.4
*/ */
declare namespace TGApp.Component.Snackbar { declare namespace TGApp.Component.Snackbar {
@@ -20,13 +20,4 @@ declare namespace TGApp.Component.Snackbar {
color?: string; color?: string;
timeout?: number; timeout?: number;
} }
/**
* @description Snackbar 方法 - displayBox
* @since Beta v0.3.3
* @function displayBox
* @param {Params} props
* @return void
*/
function displayBox(props: Params): void;
} }