Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: command for messagebox #147

Merged
merged 7 commits into from
Mar 12, 2024
Merged

Conversation

SinglePoi
Copy link
Contributor

以命令方式打开 MessageBox()

使用方式

MessageBox(content, title, options)
.then((action) => {
// this action is confirm
}).catch((action) => {
// this action is cancel
})

可选参数

content: string = "Are you sure?",
title: string = "Tips",
options: {
  confirmBtnText: "Confirm",
  cancelBtnText: "Cancel",
}

示例

let msgAction = "";
MessageBox("此操作将永久删除该文件, 是否继续?", "提示").then((action) => {
   msgAction = action;
});

更多

👉 message-box.spec.ts

@SinglePoi
Copy link
Contributor Author

糟糕,忘记补上类型了😅

@Nauxscript
Copy link
Collaborator

挺好,如果后续可以再封装一个可以命令调用的 Toast 组件就更好了🤩 这样就可以完全去掉 naive-ui#179

@Nauxscript
Copy link
Collaborator

麻烦解决一下冲突😁

@Nauxscript
Copy link
Collaborator

可以把 MessageBox.ts MessageBox.vue 以及其测试都放在一个文件夹中,这样目录架构更清晰

@Nauxscript Nauxscript merged commit 26901fe into cuixueshe:main Mar 12, 2024
1 check passed
@Nauxscript
Copy link
Collaborator

LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants