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(); }; 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;