{"id":19495425,"url":"https://github.com/nu-system/vue-dialog","last_synced_at":"2025-07-08T20:11:41.685Z","repository":{"id":57093881,"uuid":"193620334","full_name":"nu-system/vue-dialog","owner":"nu-system","description":"NU 「 no-ui 」 组件库系统 nu-system，按钮组件 VUE 实现","archived":false,"fork":false,"pushed_at":"2019-09-02T12:10:49.000Z","size":44,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T05:15:41.685Z","etag":null,"topics":["dialog","dialog-vue","nu-dialog","vue-components","vue-dialog"],"latest_commit_sha":null,"homepage":"https://nu-system.github.io/vue/dialog/","language":"JavaScript","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/nu-system.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-06-25T02:34:53.000Z","updated_at":"2019-09-02T12:10:51.000Z","dependencies_parsed_at":"2022-08-22T21:40:09.663Z","dependency_job_id":null,"html_url":"https://github.com/nu-system/vue-dialog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nu-system%2Fvue-dialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nu-system%2Fvue-dialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nu-system%2Fvue-dialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nu-system%2Fvue-dialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nu-system","download_url":"https://codeload.github.com/nu-system/vue-dialog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240741144,"owners_count":19850093,"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":["dialog","dialog-vue","nu-dialog","vue-components","vue-dialog"],"created_at":"2024-11-10T21:37:43.127Z","updated_at":"2025-02-25T20:29:57.172Z","avatar_url":"https://github.com/nu-system.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dialog\n\n[![npm package](https://img.shields.io/npm/v/@_nu/vue-dialog.svg)](https://www.npmjs.org/package/@_nu/vue-dialog)\n[![github](https://img.shields.io/github/stars/nu-system/vue-dialog.svg?style=social)](https://github.com/nu-system/vue-dialog)\n\n\u003ciframe src=\"https://codesandbox.io/embed/nudialogvue-phc9q?autoresize=1\u0026fontsize=14\u0026hidenavigation=1\u0026view=preview\" title=\"nu-dialog-vue\" allow=\"geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" sandbox=\"allow-modals allow-forms allow-popups allow-scripts allow-same-origin\"\u003e\u003c/iframe\u003e\n\n组件库母版系统 [NU-system](https://nu-system.github.io/) 弹窗组件 VUE 实现。\n\n`nu-vue-dialog` 本身不会输出任何样式，基础样式来自于 [nu-dialog](https://nu-system.github.io/vanilla/dialog/) , \n\n## 怎么用？\n\n```bash\n$ yarn add @_nu/vue-dialog @_nu/vanilla-dialog\n```\n\n### 二次封装\n\n```vue\n\n\u003cscript\u003e\n  import NuDialog from \"@_nu/vue-dialog\"\n  export default NuDialog;\n\u003c/script\u003e\n\n\u003c!--样式引用--\u003e\n\u003cstyle src=\"@_nu/vanilla-dialog\"\u003e\u003c/style\u003e\n\u003cstyle src=\"@_nu/vanilla-dialog/css/position/middle.css\"\u003e\u003c/style\u003e\n\u003c!-- \n\u003cstyle src=\"@_nu/vanilla-dialog/css/position/top.css\"\u003e\u003c/style\u003e\n\u003cstyle src=\"@_nu/vanilla-dialog/css/position/left.css\"\u003e\u003c/style\u003e\n\u003cstyle src=\"@_nu/vanilla-dialog/css/position/right.css\"\u003e\u003c/style\u003e\n\u003cstyle src=\"@_nu/vanilla-dialog/css/position/bottom.css\"\u003e\u003c/style\u003e \n--\u003e\n```\n\n\n### 使用\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv id=\"app\"\u003e    \n    \u003cbutton type=\"button\" @click=\"dialogOpen = true\"\u003e打开弹窗\u003c/button\u003e            \n    \u003cDialog :open.sync=\"dialogOpen\" :position=\"dialogPosition\"\u003e\n      \u003cselect @change=\"handlePosition\"\u003e\n        \u003coption value=\"middle\"\u003e居中显示\u003c/option\u003e\n        \u003coption value=\"top\"\u003e居上显示\u003c/option\u003e\n        \u003coption value=\"left\"\u003e居左显示\u003c/option\u003e\n        \u003coption value=\"right\"\u003e居右显示\u003c/option\u003e\n        \u003coption value=\"bottom\"\u003e居下显示\u003c/option\u003e\n      \u003c/select\u003e\n    \u003c/Dialog\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import Dialog from \"@components/Dialog\";\n  \n  export default {\n    name: 'app',\n    data() {\n      return {\n        dialogOpen: false,\n        dialogPosition: 'middle'\n      }\n    },\n    components: {\n      Dialog\n    },\n    methods: {\n        handlePosition(e) {\n         this.dialogPosition = e.target.value;\n        }\n    }\n}\n\u003c/script\u003e\n```\n\nnu-dialog-vue 会动态的把弹窗添加到 `body` 标签之后。\n\n## Api\n\n| props   |      类型      | 默认值  |功能 |\n|:----------|:-------------|:------:|------:|\n| :open.sync |  boolean | - | 显示弹窗|\n| :position |  strong | 'middle' | 弹窗位置|\n| :beforeClose |  Func | - | 在关闭之前要做的事 |\n| :isPortal | boolean | 'true' | 是否需要传送门 |\n| :speed | Number | 200 | 动画时长 |\n\n**position 可选值**: `middle`,`top`,`right`,`left`,`bottom`;\n\n**beforeClose**: 如果返回值为 `false` 那么弹窗不会关闭;\n\n## Dom 结构\n\n```vue\n\u003cdiv v-if=\"render\" class=\"nu_dialog_wrap\" :class=\"computedClass\"\u003e\n  \u003cslot name=\"mask\"\u003e\n    \u003clabel class=\"nu_dialog_mask\" @click=\"handleClickMask\"/\u003e\n  \u003c/slot\u003e\n  \u003cslot name=\"dialog\"\u003e\n    \u003cdiv class=\"nu_dialog\"\u003e\n      \u003cslot name=\"close\"\u003e\n        \u003clabel class=\"nu_dialog_close\" @click=\"handleClickClose\"\u003e\n          \u003cslot name=\"close-icon\"\u003e\u0026times;\u003c/slot\u003e\n        \u003c/label\u003e\n      \u003c/slot\u003e\n      \u003cslot\u003e\u003c/slot\u003e\n    \u003c/div\u003e\n  \u003c/slot\u003e\n\u003c/div\u003e\n```\n\n`nu-dialog-vue` 几乎所有都子组件都可以用 `slot` 重写。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnu-system%2Fvue-dialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnu-system%2Fvue-dialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnu-system%2Fvue-dialog/lists"}