mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✏️ 完善类型
This commit is contained in:
@@ -13,14 +13,14 @@ const confirmId = "tg-func-confirm";
|
||||
|
||||
/**
|
||||
* @description 自定义 confirm 组件
|
||||
* @since Beta v0.3.3
|
||||
* @since Beta v0.3.4
|
||||
* @extends ComponentInternalInstance
|
||||
* @property {Function} exposeProxy.displayBox 显示 confirm
|
||||
* @return ConfirmInstance
|
||||
*/
|
||||
interface ConfirmInstance extends ComponentInternalInstance {
|
||||
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> {
|
||||
if (confirmInstance !== undefined) {
|
||||
const boxVue = <ConfirmInstance>confirmInstance.component;
|
||||
return boxVue.exposeProxy.displayBox(props);
|
||||
return await boxVue.exposeProxy.displayBox(props);
|
||||
} else {
|
||||
confirmInstance = renderBox(props);
|
||||
return await showConfirm(props);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file component func snackbar.ts
|
||||
* @description 封装 vuetify 的 snackbar 组件,通过函数调用的方式,简化 snackbar 的使用
|
||||
* @since Beta v0.3.3
|
||||
* @since Beta v0.3.4
|
||||
*/
|
||||
|
||||
import type { ComponentInternalInstance, VNode } from "vue";
|
||||
@@ -20,7 +20,7 @@ const snackbarId = "tg-func-snackbar";
|
||||
*/
|
||||
interface SnackbarInstance extends ComponentInternalInstance {
|
||||
exposeProxy: {
|
||||
displayBox: typeof TGApp.Component.Snackbar.displayBox;
|
||||
displayBox: (props: TGApp.Component.Snackbar.Params) => void;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
11
src/types/Component/Confirm.d.ts
vendored
11
src/types/Component/Confirm.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types Component Confirm.d.ts
|
||||
* @description Component Confirm 类型声明文件
|
||||
* @since Beta v0.3.3
|
||||
* @since Beta v0.3.4
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Component.Confirm {
|
||||
@@ -53,13 +53,4 @@ declare namespace TGApp.Component.Confirm {
|
||||
* @return Params
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
11
src/types/Component/Snackbar.d.ts
vendored
11
src/types/Component/Snackbar.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types Component Snackbar.d.ts
|
||||
* @description Component Snackbar 类型声明文件
|
||||
* @since Beta v0.3.3
|
||||
* @since Beta v0.3.4
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Component.Snackbar {
|
||||
@@ -20,13 +20,4 @@ declare namespace TGApp.Component.Snackbar {
|
||||
color?: string;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Snackbar 方法 - displayBox
|
||||
* @since Beta v0.3.3
|
||||
* @function displayBox
|
||||
* @param {Params} props
|
||||
* @return void
|
||||
*/
|
||||
function displayBox(props: Params): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user