From ffe999dd2ad16fb173b14d67a8541e0ec3b9663d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Fri, 23 Aug 2024 14:56:01 +0800 Subject: [PATCH 1/2] fix(action-sheet): optimize ActionSheet component --- src/action-sheet/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/action-sheet/index.ts b/src/action-sheet/index.ts index 14df4cbf9..53e4b9a3c 100644 --- a/src/action-sheet/index.ts +++ b/src/action-sheet/index.ts @@ -17,9 +17,8 @@ function create(props: Partial): DefineComponent): DefineComponent { - visible.value = true; - }); return instance; } function ActionSheet(props: Partial) { - create(props); + return create(props); } ActionSheet.close = (trigger: any) => { @@ -56,7 +52,7 @@ ActionSheet.close = (trigger: any) => { }; ActionSheet.show = (props: Partial) => { - create(props); + return create(props); }; ActionSheet.install = (app: App, name = '') => { @@ -66,6 +62,8 @@ ActionSheet.install = (app: App, name = '') => { type ActionSheetApi = { /** 关闭ActionSheet */ close: () => void; + /** 打开ActionSheet */ + show: (props: Partial) => DefineComponent; }; export const _ActionSheet: WithInstallType & ActionSheetApi = ActionSheet as any; From 57c632177c8231bbc3571d660795392e767557b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Fri, 23 Aug 2024 16:22:29 +0800 Subject: [PATCH 2/2] docs(action-sheet): fix demo's type error --- src/action-sheet/demos/list.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action-sheet/demos/list.vue b/src/action-sheet/demos/list.vue index 63c0f6ec8..4b7a682ad 100644 --- a/src/action-sheet/demos/list.vue +++ b/src/action-sheet/demos/list.vue @@ -83,7 +83,7 @@ const badgeData = { }, ], }; -const handleSelected = (selected: ActionSheetItem, selectedIndex: number) => { +const handleSelected = (selected: ActionSheetItem | string, selectedIndex: number) => { console.log(selected, selectedIndex); ActionSheet.close(); };