Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/action-sheet/demos/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
12 changes: 5 additions & 7 deletions src/action-sheet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ function create(props: Partial<TdActionSheetProps>): DefineComponent<TdActionShe
const root = document.createElement('div');
document.body.appendChild(root);

const visible = ref(false);
const propsObject = {
visible,
defaultVisible: true,
...props,
};

Expand All @@ -39,14 +38,11 @@ function create(props: Partial<TdActionSheetProps>): DefineComponent<TdActionShe
};
app = createApp(instance, { ...propsObject });
app.mount(root);
nextTick(() => {
visible.value = true;
});
return instance;
}

function ActionSheet(props: Partial<TdActionSheetProps>) {
create(props);
return create(props);
}

ActionSheet.close = (trigger: any) => {
Expand All @@ -56,7 +52,7 @@ ActionSheet.close = (trigger: any) => {
};

ActionSheet.show = (props: Partial<TdActionSheetProps>) => {
create(props);
return create(props);
};

ActionSheet.install = (app: App, name = '') => {
Expand All @@ -66,6 +62,8 @@ ActionSheet.install = (app: App, name = '') => {
type ActionSheetApi = {
/** 关闭ActionSheet */
close: () => void;
/** 打开ActionSheet */
show: (props: Partial<TdActionSheetProps>) => DefineComponent<TdActionSheetProps>;
};

export const _ActionSheet: WithInstallType<typeof ActionSheetVue> & ActionSheetApi = ActionSheet as any;
Expand Down
Loading