diff --git a/src/components/quickcommandUI/QuickCommand.vue b/src/components/quickcommandUI/QuickCommand.vue index ae07b4c..5a72315 100644 --- a/src/components/quickcommandUI/QuickCommand.vue +++ b/src/components/quickcommandUI/QuickCommand.vue @@ -84,9 +84,10 @@ export default { this.showUI(ConfirmBox, { message, title }, false, reslove); }), - showMessageBox: (message, icon = "success", time = 3000) => { + showMessageBox: (message, icon = "success", time) => { if (icon === "success") icon = "positive"; if (icon === "error") icon = "negative"; + if (!time) time = Math.max(message.toString().length * 120, 1000); Notify.create({ type: icon, message: message, diff --git a/src/plugins/monaco/types/quickcommand.api.d.ts b/src/plugins/monaco/types/quickcommand.api.d.ts index a20867c..30a0510 100644 --- a/src/plugins/monaco/types/quickcommand.api.d.ts +++ b/src/plugins/monaco/types/quickcommand.api.d.ts @@ -138,7 +138,7 @@ interface quickcommandApi { * ``` * @param message 显示的消息内容 * @param icon 图标,默认为 success - * @param time 多少毫秒后消失,默认为 3000,当设为 0 时则需要手动点击关闭 + * @param time 多少毫秒后消失,如不指定则根据文本长度自动调整,当设为 0 时则需要手动点击关闭 */ showMessageBox( message: string,