{"id":13672916,"url":"https://github.com/mengdu/m-dialog","last_synced_at":"2025-07-04T13:06:40.107Z","repository":{"id":32262300,"uuid":"132076754","full_name":"mengdu/m-dialog","owner":"mengdu","description":"A dialog component for vue.","archived":false,"fork":false,"pushed_at":"2022-04-22T14:51:40.000Z","size":1767,"stargazers_count":30,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T21:03:55.494Z","etag":null,"topics":["alert","component","confirm","dialog","message-box","vue"],"latest_commit_sha":null,"homepage":"https://mengdu.github.io/m-dialog","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mengdu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-04T02:45:25.000Z","updated_at":"2024-01-11T07:41:34.000Z","dependencies_parsed_at":"2022-08-07T17:15:43.510Z","dependency_job_id":null,"html_url":"https://github.com/mengdu/m-dialog","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mengdu/m-dialog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mengdu%2Fm-dialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mengdu%2Fm-dialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mengdu%2Fm-dialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mengdu%2Fm-dialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mengdu","download_url":"https://codeload.github.com/mengdu/m-dialog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mengdu%2Fm-dialog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263548654,"owners_count":23478808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","component","confirm","dialog","message-box","vue"],"created_at":"2024-08-02T09:01:57.145Z","updated_at":"2025-07-04T13:06:40.077Z","avatar_url":"https://github.com/mengdu.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\n## Dialog\n\n[![NPM](https://nodei.co/npm/vue-m-dialog.png?compact=true)](https://nodei.co/npm/vue-m-dialog/)\n\nA Modal component for Vue 3.x.\n\n\u003e Please use the [2.x](tree/v2.x) in Vue 2.x.\n\n[Live Demo](https://mengdu.github.io/m-dialog/index.html)\n\n![Preview](preview.png)\n\n## Usage\n\n```ls\nnpm install vue-m-dialog\n```\n\n```js\nimport MDialogPlugin from 'vue-m-dialog'\nimport 'vue-m-dialog/dist/style.css'\n\n// will set global\n// component `\u003cm-dialog\u003e\u003c/m-dialog`\n// method `this.$alert(...)`\n// method `this.$confirm(...)`\nVue.use(MDialogPlugin)\n\n// or reset\nVue.use(MDialogPlugin, {\n  // \u003cm-dialog\u003e\u003c/m-dialog\u003e\n  dialogName: 'm-dialog',\n  // this.msg(...)\n  alertName: 'msg',\n  // this.confirm(...)\n  confirmName: 'confirm',\n  // Set default options for messageBox\n  messageBoxDefaultOptions: {\n    // ...\n  },\n})\n```\n\n```html\n\u003cm-dialog\n  v-model=\"show\"\n  title=\"Dialog Title\"\n  \u003e\n  \u003cp\u003eThis is body...\u003c/p\u003e\n  \u003cp\u003eThis is body...\u003c/p\u003e\n  \u003cp\u003eThis is body...\u003c/p\u003e\n  \u003ctemplate v-slot:footer\u003e\n    \u003cbutton class=\"m-dialog--cancel-btn\" @click=\"show = false\"\u003eCancel\u003c/button\u003e\n    \u003cbutton class=\"m-dialog--confirm-btn\" @click=\"show = false\"\u003eOkey !\u003c/button\u003e\n  \u003c/template\u003e\n\u003c/m-dialog\u003e\n```\n\n### Dialog Attributes\n\n| Attribute | Type | Description | Default |\n|-----------|------|-------------|---------|\n| modelValue/v-model | boolean | Visibility of dialog | — |\n| title | string | Title | — |\n| appendTo | string | Append dialog itself to other container; use `body`, `#\u003cID\u003e`, `null` | 'body' |\n| class | string | Custom class names for dialog | — |\n| width | string | Width of dialog | '400px' |\n| padding | string | Padding of dialog | '25px' |\n| top | string | Margin top of dialog | '50px' |\n| zIndex | string/number | zIndex for dialog wrapper | 1000 |\n| isMiddle | boolean | Show on middle | false |\n| hideHeader | boolean | Hide header | false |\n| hasMask | boolean | It has mask | true |\n| hideCloseButton | boolean | It has close button | false |\n| canClickMaskClose | boolean | Whether can be closed by clicking the mask | false |\n| draggable | boolean | Enable dragging feature for dialog  | false |\n| resetDrag | boolean | Whether to reset positon when displaying again | false |\n| isPointerEventsNone | boolean | Can click outside dialog when `hasMask=false` | false |\n| beforeClose | (cb: (ok: boolean) =\u003e void) =\u003e void | Callback before closes, and it will prevent Dialog from closing | — |\n\n### Dialog Slots\n\n| Name   | Description             |\n|--------|-------------------------|\n| -      | Content of the dialog |\n| title  | Content of the dialog title |\n| footer | Content of the dialog footer |\n\nUse the defined footer style:\n\n```html\n\u003ctemplate v-slot:footer\u003e\n  \u003cbutton class=\"m-dialog--cancel-btn\" @click=\"show = false\"\u003eCancel\u003c/button\u003e\n  \u003cbutton class=\"m-dialog--confirm-btn\" @click=\"show = false\"\u003eOkey !\u003c/button\u003e\n\u003c/template\u003e\n```\n\n### Dialog Events\n\n| Name | Description  | Params |\n|------|--------------|---------|\n| close    | Triggers when the Dialog closes | — |\n| open     | Triggers when the dialog opens | — |\n\n## MessageBox\n\nA messageBox mainly for alerting information, confirm operations.\n\n\u003e MessageBox plugin base on Dialog component.\n\n```js\nimport { alert, confirm, createMessageBox, closeAll } from 'vue-m-dialog'\n```\n\nInterface of messageBox\n\n```ts\nimport { AppContext } from 'vue';\nexport interface MessageBoxOptions {\n    title?: string;\n    message?: string | JSX.Element | (() =\u003e JSX.Element);\n    class?: string;\n    width?: string;\n    padding?: string;\n    top?: string;\n    zIndex?: string | number;\n    isMiddle?: boolean;\n    hideHeader?: boolean;\n    hasMask?: boolean;\n    draggable?: boolean;\n    isPointerEventsNone?: boolean;\n    showCancelButton?: boolean;\n    showConfirmButton?: boolean;\n    disableCancelButton?: boolean;\n    disableConfirmButton?: boolean;\n    cancelButtonText?: string;\n    confirmButtonText?: string;\n    beforeClose?: (cb: (ok: boolean) =\u003e void) =\u003e void;\n    onOpen?: () =\u003e void;\n    onRemove?: () =\u003e void;\n    [key: string]: any;\n}\nexport declare function createMessageBox(options: MessageBoxOptions, context?: AppContext): Promise\u003c{\n    action: string;\n    ok: boolean;\n}\u003e;\nexport declare const alert: (message: string, title?: string | undefined, options?: MessageBoxOptions | undefined, context?: AppContext | undefined) =\u003e Promise\u003c{\n    action: string;\n    ok: boolean;\n}\u003e;\nexport declare const confirm: (message: string, title?: string | undefined, options?: MessageBoxOptions | undefined, context?: AppContext | undefined) =\u003e Promise\u003c{\n    action: string;\n    ok: boolean;\n}\u003e;\nexport declare const closeAll: () =\u003e void;\nexport declare const setDefaultOptions: (opts?: MessageBoxOptions | undefined) =\u003e void;\n```\n\n### LICENSE\n\nMIT [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmengdu%2Fm-dialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmengdu%2Fm-dialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmengdu%2Fm-dialog/lists"}